小编Sna*_*yes的帖子

Make - 没有什么可做的 - 只有文件扩展名

我有一个简单的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,即没有扩展名.

有人可以解释为什么会这样吗?

c makefile compilation

4
推荐指数
1
解决办法
4538
查看次数

循环内外的变量的多个声明相同

#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)

此变量ifor循环外声明,并在for循环内再次声明和初始化.C如何允许多个声明?

c variable-declaration

4
推荐指数
1
解决办法
71
查看次数

打印字符串时正在打印(null)

我写了一个C程序,它从用户那里获取一个字符串输入并将其打印在屏幕上.

int main (void)
{
    char* string;
    scanf("%s", string);
    printf("%s", string);
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

但是输出是不可取的.

我给了输入foo.程序打印出来(null).谁能解释为什么?

c string printf pointers scanf

2
推荐指数
1
解决办法
70
查看次数