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 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 contribute.geeksforgeeks.org or mail your article to contribute@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.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
Recommended Posts:
- Print substring of a given string without using any string function and loop in C
- Write a C program to print "GfG" repeatedly without using loop, recursion and any control structure?
- How to print range of basic data types without any library function and constant in C?
- Print "Hello World" in C/C++ without using any header file
- Print all possible combinations of the string by replacing '$' with any other digit from the string
- To find sum of two numbers without using any operator
- Implementing ternary operator without any conditional statement
- Write a C program to print "Geeks for Geeks" without using a semicolon
- C Program to print numbers from 1 to N without using semicolon?
- C program to print characters without using format specifiers
- How to find length of a string without string.h and loop in C?
- C/C++ program to find the size of int, float, double and char
- How will you print numbers from 1 to 100 without using loop?
- Print "Even" or "Odd" without using conditional statement
- Print 1 to 100 in C++, without loop and recursion
- Print individual digits as words without using if or switch
- Print 2D matrix in different lines and without curly braces in C/C++?
- How to print a semicolon(;) without using semicolon in C/C++?
- Print Hello World without semicolon in C/C++
- How to print a number 100 times without using loop and recursion in C?

