warning: format ‘%d’ expects type ‘int *’, but argument 2 has type ‘int’

前端 未结 7 1753
醉话见心
醉话见心 2020-12-09 20:39

So I\'m new to C and am having trouble with whats happening with this warning. What does the warning mean and how can i fix it. The code i wrote is here:

voi         


        
相关标签:
7条回答
  • 2020-12-09 21:20

    It mean that it expect a "int *" (That is: A pointer to an integer) but you give it "int" which is an integer. To fix it add & to age in the scanf line so it become.

    scanf("%d\n", age);

    0 讨论(0)
提交回复
热议问题