Open In App

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

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Share
Report issue
Report

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

 


Last Updated : 31 Jan, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads