C Programming - C Preprocessor - Discussion
Discussion Forum : C Preprocessor - Find Output of Program (Q.No. 4)
4.
What will be the output of the program?
#include<stdio.h>
#define JOIN(s1, s2) printf("%s=%s %s=%s \n", #s1, s1, #s2, s2);
int main()
{
char *str1="India";
char *str2="BIX";
JOIN(str1, str2);
return 0;
}
Discussion:
35 comments Page 4 of 4.
Nikhil said:
1 decade ago
## concatenates not a single #
Prasad Shinde said:
1 decade ago
# means a concatenation operator in C.
It concats 2 strings.
It concats 2 strings.
Krishz said:
1 decade ago
Ya you are right vasuuma:-).
Vasuuma said:
2 decades ago
# mean to variable name. so #s1 gives output as str1
Nachiyappan said:
2 decades ago
Is it possible to print value through pre-processor ?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers