You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
989 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#include <bits/stdc++.h>
using namespace std;
int main() {
/*
%d 有符号32位整数
%u 无符号32位整数
%lld 有符号64位整数
*/
printf("short:%d bytes,max=%d,min=%d\n", (int)sizeof(short), SHRT_MAX, SHRT_MIN);
printf("unsigned short:%d bytes,max=%d\n", (int)sizeof(unsigned short), USHRT_MAX, 0);
puts("");
printf("int:%d bytes,max=%d,min=%d\n", (int)sizeof(int), INT_MAX, INT_MIN);
printf("unsigned int:%d bytes,max=%u\n", (int)sizeof(unsigned int), UINT_MAX, 0);
puts("");
printf("long long:%d bytes,max=%lld,min=%lld\n", (int)sizeof(long long));
//使用 %lld 就可以打印一个unsigned long long了glib中的guint64就是unsigned long long。这是GNU编译器支持的。
printf("unsigned long long:%d bytes,max=%lld,min=%d\n", (int)sizeof(unsigned long long));
double a = 1, b = 1;
if (a * b == 1)
printf("True");
else
printf("False");
return 0;
}