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?
Discussion:
31 comments Page 3 of 4.
Rajan said:
1 decade ago
'c' is correct one because of it has neither semicolon nor lower case.
NRV said:
1 decade ago
Option 'A' wont work because of the semicolon...
Option 'B' wont work because 'X' is of lowercase and also the spaces cant be allowed btwn them..
Option 'D' wont work because curly braces cannot be used.
And hence d Option "C "
Option 'B' wont work because 'X' is of lowercase and also the spaces cant be allowed btwn them..
Option 'D' wont work because curly braces cannot be used.
And hence d Option "C "
S.Parthasarathy said:
1 decade ago
Option B is the correct one... In preprocessor we can use lower cases also to define a function.. It is not compulsory to use higher cases..)
:-) said:
1 decade ago
It is working Properly...
#define CUBE(X) (X*X*X)
#define CUBE(X) (X*X*X);
#define CUBE(X)(X*X*X)
#define CUBE(X) (X*X*X)
#define CUBE(X) (X*X*X);
#define CUBE(X)(X*X*X)
Khalid said:
1 decade ago
Semicolon and spaces between (x)and (x*x*x) makes option A wrong
Singh said:
1 decade ago
Option A will not be complile as between CUBE and (X) their is space
and their is no provision for double define value without \.
and their is no provision for double define value without \.
Kamal said:
1 decade ago
How could option C be correct? There is no space between CUBE(X) and (X*X*X). Please someone explain it.
Arjun said:
1 decade ago
Is it not necessary to have a space in C?
Aniruddha said:
1 decade ago
Hey nice observation @saritha.
Saritha said:
1 decade ago
A and be will not work because option a has semicolon and preprocessor doesn't have semicolon.
In option b the x is a lowercase argument and used as uppercase.
In option b the x is a lowercase argument and used as uppercase.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers