- 论坛徽章:
- 0
|
在gcc内核的各个编译器中编译以下使用了C99的测试程序,却出现同样错误,不得其解,恳请指点!- /* test c99 storage class feateures */
- #include <stdio.h>
- int main(void)
- {
- long a;
- printf("Input the value of a: ");
- scanf("%ld", &a);
- if(a > 0)
- {
- int b;
- printf("\nNow input the value of b: ");
- scanf("%d", &b);
- for(int i = 0; i < a; i++)
- a += b;
- printf("\na now becomes: %ld", a);
- }
- else if(a < 0)
- {
- int b;
- printf("\nNow input the value of b: ");
- scanf("%d", &b);
- for(int i = 0; i < -a; i++)
- a -= b;
- printf("\na now becomes: %ld", a);
- }
- else
- puts("\nSorry, we ain't want no zeros! Bye!");
- return 0;
- }
复制代码 运行情况:
|
|