/*数据类型*/
/*标识符命名规则:
1、由数字、字母、下划线(_)组成
2、不能以数字开头
3、不能是关键字
4、区分大小写
*/
#include <stdio.h>
int main()
{
/*int类型*/
int a = 0; //默认类型:-2147483648~2147483647
short int b = 1; //-32768~32767
long int c = 2L; //-2147483648~2147483647
long long int d = 3LL; //-9223372036854775808~9223372036854775807
signed short int e = -4; //默认有符号:-32768~32767
unsigned short int f = 5; //无符号:0~65535
printf("%d\n%d\n%ld\n%lld\n%d\n%u\n",a,b,c,d,e,f);
/*小数类型*/
float g = 3.141592F; //默认保留6位,可通过.2%f控制
double h = 3.1415826; //小数默认数据类型,默认保留6位
printf("%.2f\n%.2f\n",g,h);
/*字符*/
char ch = 'a';
printf("%c\n",ch);
return 0;
}
C语言没有字符串类型的变量。