simple c program keeps crashing

前端 未结 2 1639
礼貌的吻别
礼貌的吻别 2021-01-25 13:50
#include 
int main(void)
{
int a,b,c;
printf(\"Enter values of a,b,c:\");
scanf(\"%d %d %d\",a,b,c);

printf(\"\\nDescending order of the numbers entered:         


        
2条回答
  •  后悔当初
    2021-01-25 14:30

    Try to use:-

    scanf("%d %d %d",&a,&b,&c)
    

    instead of

    scanf("%d %d %d",a,b,c) 
    

    as & refers to the address of your variables.

    In C the parameters are passed by value so you need to pass the address (or pointer). When you pass the address (or pointer) then scanf knows where it has to put the value.

提交回复
热议问题