long& int 的输出问题
#include <stdio.h>int main(void)
{
long sum =0;//int OK
long i;
while(i<10)
{
if(i&1) //even
{
goto update;
i++;
}
sum +=i;
update:
i++;
}
printf("sum = %ld\n", sum);
} 我的VS2017,两个运行结果一样一样的{:10_327:} When writing in C or C++, every datatype is architecture and compiler specific. On one system int is 32, but you can find ones where it is 16 or 64; it's not defined, so it's up to compiler.
https://stackoverflow.com/questions/7456902/long-vs-int-c-c-whats-the-point xypmyp 发表于 2018-6-9 23:34
When writing in C or C++, every datatype is architecture and compiler specific. On one system int is ...
Your answer perfectly solved my puzzle! THX ^_^ oh perfect your english si so good
页:
[1]