C语言和C++中的数据类型介绍
程序员文章站
2022-03-26 17:49:22
c语言于c99 这个标准中添加long long 类型。
#include
#include
//编译指令:gcc -std=c99 -pedantic
int main(v...
c语言于c99 这个标准中添加long long 类型。
#include #include //编译指令:gcc -std=c99 -pedantic int main(void) { char c_min = schar_min; char c_max = schar_max; unsigned char uc_max = uchar_max; long l_min = long_min; short s_min = shrt_min; long long ll_min = llong_min;//c99增加long long 类型 long long ll_max = llong_max; unsigned long long ull_max = ullong_max; printf ("max of unsigned char:%d\n", uc_max); printf("min of char:%d\n", c_min); printf("max of char:%d\n", c_max); printf("min of short:%d\n", s_min); printf("min of long:%ld\n", l_min); printf("min of long long : %lld\n", ll_min); printf("max of long long : %lld\n", ll_max); printf ("max of unsigned long long : %llu\n", ull_max); return 0; }
c++ 语言在c++11 这个标准中增加 long long 类型。
#include #include //g++ -std=c++03 -pedantic lim.cpp 无法通过编译,c++1998 不支持 long long 类型 using namespace std; int main() { // singed 标识符一般省略 char c_min = schar_min; char c_max = schar_max; unsigned char uc_max = uchar_max; long l_min = long_min;//long int 简写为long short s_min = shrt_min; //short int 简写为 short long long ll_min = llong_min;//long long int 简写为long long long long ll_max = llong_max; unsigned long long ull_max = ullong_max; printf ("max of unsigned char:%d\n", uc_max); printf("min of char:%d\n", c_min); printf("max of char:%d\n", c_max); printf("min of short:%d\n", s_min); printf("min of long:%ld\n", l_min); printf("min of long long : %lld\n", ll_min); printf("max of long long : %lld\n", ll_max); printf ("max of unsigned long long : %llu\n", ull_max); return 0; }