Exforsys
+ Reply to Thread
Results 1 to 4 of 4

syntax error at end of input

This is a discussion on syntax error at end of input within the C and C++ forums, part of the Programming Talk category; i have this project in my cs class and the code always generate a "syntax error at end of input" ...

  1. #1
    immaprogrammer is offline Junior Member Array
    Join Date
    Mar 2011
    Answers
    1

    syntax error at end of input

    i have this project in my cs class and the code always generate a "syntax error at end of input" message. i double checked the placement of the curly braces but I can't seem to find an error. Here's the chunk of code:

    Code:
    void func3(char *ans_ptr)
       {
              char *ans;
              int ctr=0;
              if(*ans_ptr == 'C'|| *ans_ptr=='c')
       {         
              ctr++;
              printf("Correct!\n");
       }
              else
       {
              printf("Sorry! You're wrong! \n"); 
              getchar();
       } 
       }
    can anyone tell me what's wrong?


  2. #2
    techvinny is offline Moderator Array
    Join Date
    Dec 2010
    Answers
    56
    variable ans is not being used anywhere. May be, removing that should resolve the problem. Would have been helpful if you could have pasted the entire code, at times the problem may lie outside of this block of function.


  3. #3
    allldo is offline Junior Member Array
    Join Date
    Mar 2011
    Answers
    2
    hi, is any one can help me...?

    I'm very new in c++ and now I want to write a syntax for input number 111 which will give out put in chart (hundredth eleven). please write for me a simple syntax so I can understand it. THX


  4. #4
    techvinny is offline Moderator Array
    Join Date
    Dec 2010
    Answers
    56
    hi allldo...try using itoa function from string.h library...


    •    Sponsored Ads



Latest Article

Network Security Risk Assessment and Measurement

Read More...