1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

preprocessor

Discussion in 'C' started by ghostrider12345, Mar 12, 2013.

  1. ghostrider12345

    ghostrider12345 New Member

    Why does the following line of code generate error as " pasting / and / doesnot generate a valid preprocessing token"? Can someone please help



    #define comment /##/
    int main()
    {
    comment printf("hello");
    return 0;
    }
     
  2. shabbir

    shabbir Administrator Staff Member

    Comment is /**/ and not /##/ BTW
     
  3. ghostrider12345

    ghostrider12345 New Member

    I know that Sir this question deals with pasting / and / which surely forms a single line comment
     
  4. shabbir

    shabbir Administrator Staff Member

    So why you think /##/ would give you output as //?
     
  5. ghostrider12345

    ghostrider12345 New Member

    Its a preprocessor token pasting operator which joins its operands to make a valid token!!!
     
  6. shabbir

    shabbir Administrator Staff Member

    http://gcc.gnu.org/onlinedocs/cpp/Concatenation.html

    It says clearly and I quote
     
  7. aroraaisha

    aroraaisha New Member

    # this is symbol of preprocessor.
    Ex- #include<stdio.h>
    #include<conio.h>
    void main()
    {
    {
    }
    getch()
    }
     

Share This Page