#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    1
    Rep Power
    0

    Urgent Help needed


    here is my code i m getting two errors..'

    #include<stdio.h>
    #include<string.h>


    int main()
    {
    int apoll=1,pp=1,ae=1,dd=1;
    char name[50];
    int a,b,c;
    printf("Welcome to KBC . Enter you name.. \n");
    gets(name);
    void questions(int ,int ,int ,int)
    questions(&apoll,&pp,&ae,&dd); <===="syntex error before 'question'..

    getch();
    }

    //Function of question

    void questions(int *a,int *p,int*e,int *d)
    { int a2=*a,p2=*p,e2=*e,d2=*d;
    char uans[50],ans[50],ll;
    printf("First question : Who is God of cricket ?\n ");<===="syntex error before 'printf'..


    printf("A:Dravid B:Sachin\nC:Ganguly D:Dhoni\n");
    ans="Sachin\0";
    printf("Do you want a life-line Y or N : \n");
    scanf("%c",&ll);
    if( ll == 'n')
    { printf("Enter your answer : ");
    gets(uans);
    if( strcmp(ans,uans)==0)
    {
    printf("\nYou are correct \n");
    }
    else
    {
    printf("Afsos ye jawab galat hei\n");
    }
    }

    if( ll=='y')
    { void lifeline(int ,int ,int ,int)
    lifeline(&a2,&p2,&e2,&d2);
    printf("Enter your answer : ");
    gets(uans);
    if( strcmp(ans,uans)==0)
    {
    printf("\nYou are correct \n");
    printf("Remaining lifelines : ap=%d , pp=%d , ae=%d , dd=%d \n",*a,*p,*e,*d);
    }
    else
    {
    printf("Afsos ye jawab galat hei\n");
    }}
    else
    {
    printf("invalid choice\n");

    }
    }
    //function of lifelines...

    void lifeline(int *a3,int *p3,int *e3,int *d3)
    { int life;
    printf("which lifeline you would like to use? \n");
    printf("1.apoll 2.pf 3.ea 4.dd : ");
    scanf("%d",&life);


    if( life == 1)
    {
    printf("\nyou have choosed apoll ");
    }
    else if( life == 2)
    {
    printf("\nyou have choosed pf ");
    }
    else if( life == 3)
    {
    printf("\nyou have choosed ea ");
    }
    else if( life == 4)
    {
    printf("\nyou have choosed dd ");
    }
    else
    {
    printf("invalid choice\n");

    }
    }
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,837
    Rep Power
    480
    void questions(int ,int ,int ,int) ;/*semi-colon needed here */
    questions(&apoll,&pp,&ae,&dd);
    [code]Code tags[/code] are essential for python code and Makefiles!
  4. #3
  5. Lord of the Dance
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Oct 2003
    Posts
    3,576
    Rep Power
    1906
    Originally Posted by b49P23TIvg
    void questions(int ,int ,int ,int) ;/*semi-colon needed here */
    It should be placed before main?
  6. #4
  7. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,837
    Rep Power
    480
    certainly more common placed before main. Either way, it needs a semi-colon.
    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo