C Programming - C Preprocessor - Discussion

Discussion Forum : C Preprocessor - Point Out Correct Statements (Q.No. 2)
2.
Which of the following are correctly formed #define statements in C?
#define CUBE (X) (X*X*X);
#define CUBE(x) (X*X*X)
#define CUBE(X)(X*X*X)
#define CUBE(X) {X*X*X}
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
31 comments Page 3 of 4.

Nimesh said:   1 decade ago
The mai error in option A is because space between
CUBE and (X)...check out CUBE (X)

Aniruddh said:   1 decade ago
Not only 3 but all 4 macro definitions are working properly with dev cpp compiler.

Rajan said:   1 decade ago
'c' is correct one because of it has neither semicolon nor lower case.

Khalid said:   1 decade ago
Semicolon and spaces between (x)and (x*x*x) makes option A wrong

Uday M said:   8 years ago
IN GCC compiler, both B, C answer is correct.

Arjun said:   1 decade ago
Is it not necessary to have a space in C?

Chaitali said:   1 decade ago
Why not a or b?
Please explain...

Vemula Durgarao said:   8 years ago
Why not A?

Why its answer is c?
(1)

Aniruddha said:   1 decade ago
Hey nice observation @saritha.

Vishnu said:   1 decade ago
Both a and b will work.


Post your comments here:

Your comments will be displayed after verification.