can i #define a character.
for example the value of the char. 'N' is 78
'E' is 69
'N' + 'E' = 147
i want to #define NE 147
is this possible??
can i #define a character.
for example the value of the char. 'N' is 78
'E' is 69
'N' + 'E' = 147
i want to #define NE 147
is this possible??
you could do something like this
then it would work for any letter.Code:#include <stdio.h> #define ADD_CHAR(a,b)(a+b) int main() { printf("%d",ADD_CHAR('N','E')); return 0; }
just a thought
All spelling mistakes, syntatical errors and stupid comments are intentional.
Yes
you can #define NE 147
so 'N'+'E'==NE would be true.
#define QUESTION ( 2B || !(2B) )
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Hate to be the one to tell ya this Salem, but your code is invalid.
Compiling...Code:#include <stdio.h> #define QUESTION ( 2B || !(2B) ) int main ( void ) { return printf("%d", QUESTION ); }
test1.c
c:\windows\desktop\test.c\test1.c(6) : error C2059: syntax error : 'bad suffix on number'
c:\windows\desktop\test.c\test1.c(6) : error C2146: syntax error : missing ')' before identifier 'B'
c:\windows\desktop\test.c\test1.c(6) : error C2059: syntax error : 'bad suffix on number'
Error executing cl.exe.
test1.exe - 3 error(s), 0 warning(s)
...And then, as I was typing this message, I actually _read_ the code. Good one, you got me there. Good show!
Quzah.
lol @ Quzah
Free the weed!! Class B to class C is not good enough!!
And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi
CoolOriginally posted by Salem
#define QUESTION ( 2B || !(2B) )
How about writing a whole novel in C?