

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
# and ## Operators in C ?
In this section we will see what are the Stringize operator(#) and Token Pasting operator(##) in C. The Stringize operator is a preprocessor operator. It sends commands to compiler to convert a token into string. We use this operator at the macro definition.
Using stringize operator we can convert some text into string without using any quotes.
Example
#include<stdio.h> #define STR_PRINT(x) #x main() { printf(STR_PRINT(This is a string without double quotes)); }
Output
This is a string without double quotes
The Token Pasting operator is a preprocessor operator. It sends commands to compiler to add or concatenate two tokens into one string. We use this operator at the macro definition.
Example
#include<stdio.h> #define STR_CONCAT(x, y) x##y main() { printf("%d", STR_CONCAT(20, 50)); }
Output
2050
- Related Questions & Answers
- Hash Functions and Hash Tables
- Equality Operators: == and != in C++
- Relational and comparison operators in C++
- Increment ++ and decrement -- Operators in C++
- Operators, Types and Variables in C#
- Increment and Decrement Operators in C#
- Relational and Logical Operators in C
- C++ Relational and Equality Operators
- C++ Operators with Precedence and Associativity
- C# Bitwise and Bit Shift Operators
- What are C operators and Punctuators?
- Left Shift and Right Shift Operators in C/C++
- What are increment (++) and decrement (--) operators in C#?
- Difference between prefix and postfix operators in C#?
- Ternary Operators in C/C++
Advertisements