I am wondering if the following are the same:
#define IDEFAULT (-1)
and
#define IDEFAULT (int) -1
I am wondering if the following are the same:
#define IDEFAULT (-1)
and
#define IDEFAULT (int) -1
I am wondering if the following are the same :
Both are the same, in the sense that they produce a syntax error.
It seems that you are trying to use a Macro in C, and for that the correct syntax is:
#define macro-name char-sequence
so I would write for example:
#define myMacro -1
where myMacro
is going to be equal to -1. If I surround -1 with parentheses, it won't make a difference. Read more about it in Why use Macros in C?
PS: The syntax errors however, are not identical:
main.c:3:9: error: expected declaration specifiers or '...' before '-' token
3 | define (-1)
| ^
and
main.c:3:1: warning: return type defaults to 'int' [-Wimplicit-int]
3 | define (int) -1
| ^~~~~~
main.c: In function 'define':
main.c:3:14: error: expected declaration specifiers before '-' token
3 | define (int) -1
| ^
main.c:3:9: error: parameter name omitted
3 | define (int) -1
| ^~~
main.c:8: error: expected '{' at end of input
8 | }
|