Skip to content
Related Articles
Open in App
Not now

Related Articles

C program to print a string without any quote (single or double) in the program

Improve Article
Save Article
  • Difficulty Level : Easy
  • Last Updated : 31 Jan, 2022
Improve Article
Save Article

Print a string without using quotes anywhere in the program using C or C++. 
Note : should not read input from the console.

 

The idea is to use macro processor in C (Refer point 6 of this article). A token passed to macro can be converted to a string literal by using # before it. 
 

C




// C program to print a string without
// quote in the program
#include <stdio.h>
#define get(x) #x
int main()
{
    printf(get(vignesh));
    return 0;
}

Output: 
 

vignesh

This article is contributed by Vignesh. If you like GeeksforGeeks and would like to contribute, you can also write an article using write.geeksforgeeks.org or mail your article to review-team@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
 

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!