Pergunta

Is there a way to use a preprocessor directive without using the # character in C code? Can we echo the hash character somehow by using its ASCII etc. equivalents?

Eg: 1 can be echoed by using 'SOH' in the .c source file. Is there a similar hack for '#'?

Foi útil?

Solução

You can use the digraph or trigraph equivalent if your compiler supports them (you may need to pass flags to the compiler):

digraph: %:

trigraph: ??=

However, if you're trying to use preprocessor macros to generate preprocessor commands, there's no way to do that.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top