int main()
{
printf("My name is %s\n", "Ruo");
printf("My number is %d", 22212111039);
return 0;
}
为什么这样输出的数字“student number会变呢?
int main()
{
printf("My name is %s\n", "Ruo");
printf("My number is %d", 22212111039);
return 0;
}
为什么这样输出的数字“student number会变呢?
望采纳。在C语言中,如果要格式化输出很长的数字,可以使用 %lld 这种格式。例如:
#include <stdio.h>
int main()
{
printf("My number is %lld\n", 22212111039LL);
return 0;
}
上面使用了 %lld 格式,它表示输出一个长整型数(long long)。我们还要使用 LL 后缀,表示这是一个长整型数常量。
另外,你还可以使用 %u 格式来输出无符号整数,例如:
#include <stdio.h>
int main()
{
printf("My number is %u\n", 22212111039U);
return 0;
}
上面使用了 %u 格式,它表示输出一个无符号整数。我们还要使用 U 后缀,表示这是一个无符号整数常量。