- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- 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
C program to print a string without any quote in the program
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
Advertisements