Pregunta

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 '#'?

¿Fue útil?

Solución

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 bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top