- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Write a C macro PRINT(x) which prints x
Here we will see how to define a macro called PRINT(x), and this will print whatever the value of x, passed as an argument.
To solve this problem, we will use the stringize operator. Using this operator the x is converted into string, then by calling the printf() function internally, the value of x will be printed. Let us see the example to get the better idea.
Example
#include <stdio.h> #define PRINT(x) printf(#x) int main () { PRINT(Hello); printf("
"); PRINT(26); printf("
"); PRINT(2.354721); printf("
"); }
Output
Hello 26 2.354721
- Related Articles
- C++ Program to Print X Star Pattern
- Which of the following is a factor of $f( x)=x^{2}-9 x+20?$$A). ( x-2)$$B). ( x-3)$$C). ( x-4)$$D). ( x-5)$
- Print a number 100 times without using loop, recursion and macro expansion in C
- Find the value of $(x-a)^3 + (x-b)^3 + (x-c)^3 - 3 (x-a)(x-b)(x-c)$ if $a+b+c = 3x$
- Simplify:( left(frac{x^{a+b}}{x^{c}}right)^{a-b}left(frac{x^{b+c}}{x^{a}}right)^{b-c}left(frac{x^{c+a}}{x^{b}}right)^{c-a} )
- Which of the following is not a polynomial?(a) $x^{2}+sqrt{2} x+3$ (b) $x^{3}+3 x^{2}-3$ (c) $6 x+4$ d) $x^{2}-sqrt{2 x}+6$
- Write a program to calculate pow(x,n) in C++
- Prove that( frac{1}{1+x^{b-a}+x^{c-a}}+frac{1}{1+x^{a-b}+x^{c-b}}+frac{1}{1+x^{b-c}+x^{a-c}}=1 )
- Determine which of the following polynomials has ( (x+1) ) a factor:(i) ( x^{3}+x^{2}+x+1 )(ii) ( x^{4}+x^{3}+x^{2}+x+1 )
- Prove that:( left(frac{x^{a}}{x^{b}}right)^{c} timesleft(frac{x^{b}}{x^{c}}right)^{a} timesleft(frac{x^{c}}{x^{a}}right)^{b}=1 )
- Which one of the following is a polynomial?(A) $frac{x^{2}}{2}-frac{2}{x^{2}}$(B) $sqrt{2 x}-1$(C) $ x^{2}+frac{3 x^{frac{3}{2}}}{sqrt{x}}$
- Write the coefficient of x in each term of the following expressions: (a) $2 a^{2}-x a$ (b) $3 x^{2}-x+y$
- Print all nodes less than a value x in a Min Heap in C++
- Prove that both the roots of the equation $(x-a)(x-b)+(x-b)(x-c)+(x-c)(x-a)=0$ are real but they are equal only when $a=b=c$.
- For which values of ( a ) and ( b ), are the zeroes of ( q(x)=x^{3}+2 x^{2}+a ) also the zeroes of the polynomial ( p(x)=x^{5}-x^{4}-4 x^{3}+3 x^{2}+3 x+b ) ? Which zeroes of ( p(x) ) are not the zeroes of ( q(x) ) ?

Advertisements