C lang
c lang在windows下的开发(VS code)
WinLibs - GCC+MinGW-w64 compiler for Windows下载你需要的版本
解压到D:\ProgramModule,并将 bin\加入环境变量PATH
打开新的Terminal输入gcc -v,查看gcc是否安装成功
在VS code 的插件管理下载Code Runner、C\C++这两个插件
在*.c源文件的内容区,右键点击Run Code ,即可运行成功
数据类型
- 整数类型
1
2
3
4
5
6
7
8
9
10
11short a = 12;
int b = 100;
long c = 1000L;
long long d = 1000000LL;
unsigned int e = 10;
printf("a: %hd\n",a);
printf("b: %d\n",b);
printf("c: %ld\n",c);
printf("d: %lld\n",d);
printf("e: %u\n",e);
printf("f: %.3f\n",f); - 小数类型
1
2
3
4float f = 3.14F;
printf("f: %.3f\n",f);
double g = 5.65;
printf("g: %.2lf\n",g); - 字符类型
1
2char h = 'x';
printf("x: %c\n",x);
类型转换
- 隐式转换
- 强制转换
1
2int b = 23;
short c = (short) b;
数组
1 |
|
指针
1 | // swap the value of a and b |
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 QuickReference!