multiple scanf in a program causing crash in c?

前端 未结 3 1788
灰色年华
灰色年华 2021-01-29 03:18
#include 

int main()
{       
    printf(\"how old are you? \");
    int age = 0;
    scanf(\"%d\", age);

    printf(\"how much does your daily habit co         


        
3条回答
  •  庸人自扰
    2021-01-29 03:46

    The scanf function expects a pointer.

    scanf("%d", &age);
    

    Ditto for the line where you scanf on "daily".

提交回复
热议问题