GeeksforGeeks » Interview Questions

Interview Question for Software Engineer/Developer (Fresher) about CPuzzles

(3 posts)

Tags:

  1. ganesh
    guest
    Posted 1 year ago #

    int main()
    {
       #ifdef TRUE
       /* Error?
       int a;
       a = 10;
       #else
       int a;
       a = 20;
       #endif
       printf("%d",a);
       return 0;
    }
    

    a) 20
    b) 10
    c) Error because unterminated comment
    d) Error since preprocessor directives must precede all declarations

  2. natasha
    guest
    Posted 1 year ago #

    d) Error since preprocessor directives must precede all declarations

  3. gtikok
    guest
    Posted 1 year ago #

    c)

    Code below third line is treat as a comment, so compile code is

    int main()
    {
    #ifdef TRUE


Reply

You must log in to post.

RSS feed for this topic