曾经我自诩半个诗人,见山是深情伟岸,见海是热情澎湃,见花见草信他们皆有故事,云海江潮,虫鸣鸟啼都暗藏情愫。唯独见了你,山川沉默,海面静谧,云海不再翻涌,江潮不再澎湃,花鸟鱼虫被光与尘凝固,世界万籁俱寂,只剩下你!---C语言。
C语言一些有趣的现象(例子)
以下是一些有趣的C程序小例子,只限欣赏,并无太多实际意义,切勿模仿。
1) case 可以位于if-else 内部
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char *argv[]) { int a = 2, b = 2; switch (a) { case 1: ; if (b == 5) { case 2: printf("我好帅"); } else case 3: { printf("还是你帅"); } } getchar(); return 0; }
2)数组名和下标可以互换 , arr[index] 等于 index[arr]
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char *argv[]) { int array[10]; array[3] = 1; printf("%d", 0[array]); getchar(); return 0; }
3)在非常规的位置使用#include
myHead.txt 中内容:("I Love you but you do not Love me")
4)%*d 用在scanf 里面可以忽略input