【发布时间】:2022-11-22 23:53:43
【问题描述】:
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
long x, y;
printf("Enter the first number: \n");
scanf("%ld", &x);
printf("Enter the second number: \n");
scanf("%ld", &y);
long z = x + y;
printf("The answer is: %ld \n", z);
return 0;
}
我不能在这里添加超过 40 亿,尽管我应该在这里添加,因为我在这里使用“Long”数据类型。
【问题讨论】:
-
在 Windows 上,
long和int的宽度相同。在其他平台上long可能更大。您可以使用sizeof(int)和sizeof(long)进行检查。
标签: c