我有一个简单的c程序 - hello_world.c
你可以通过文件名来判断我对c非常新.
我希望编译以下内容:
make hello_world.c
Run Code Online (Sandbox Code Playgroud)
但这会给出一条错误消息: make: Nothing to be done for hello_world.c.
如果我只是这样做make hello_world,即没有扩展名.
有人可以解释为什么会这样吗?
#include <stdio.h>
int main()
{
int i;
for ( i=0; i<5; i++ )
{
int i = 10;
printf ( "%d", i );
i++;
}
return 0;
}
Run Code Online (Sandbox Code Playgroud)
此变量i在for循环外声明,并在for循环内再次声明和初始化.C如何允许多个声明?
我写了一个C程序,它从用户那里获取一个字符串输入并将其打印在屏幕上.
int main (void)
{
char* string;
scanf("%s", string);
printf("%s", string);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
但是输出是不可取的.
我给了输入foo.程序打印出来(null).谁能解释为什么?