This is another tricky problem. In this program, we will see how to print a string using C where no quotation marks are used.
Here we are using macro function. We are defining a macro function like
#define getString(x) #x
The getString() is a macro function. It returns x by converting it into a string. The # before x is denoting that the function will convert x into a string.
Input: Take one string without quote Output: Print that string into console
Algorithm
Step 1:Take a string without quote Step 2: Use macro function to print it into a string Step 3: End
Example Code
#include<stdio.h> #define getString(x) #x //The # will convert x into a string main() { printf(getString(Hello World)); }
Output:
Hello World