2
Contributors
2
Replies
4
Views
5 Years
Discussion Span
Last Post by student_learner
1

It's the preprocessor's pastie operator. It takes two tokens and concatenates them into a single token. For example:

#include <stdio.h>

#define PASTIE(prefix, var) prefix ## var

int main(void)
{
    char const* strFoo = "foo!";
    
    puts(PASTIE(str, Foo));
    
    return 0;
}

Neither str nor Foo are meaningful by themselves, but when combined they match the variable name strFoo, so this code both compiles and prints "foo!" to stdout.

Edited by deceptikon: n/a

0

It's the preprocessor's pastie operator. It takes two tokens and concatenates them into a single token. For example:

#include <stdio.h>

#define PASTIE(prefix, var) prefix ## var

int main(void)
{
    char const* strFoo = "foo!";
    
    puts(PASTIE(str, Foo));
    
    return 0;
}

Neither str nor Foo are meaningful by themselves, but when combined they match the variable name strFoo, so this code both compiles and prints "foo!" to stdout.

thnxx!! got it..:)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.