
- C Programming Tutorial
- C - Home
- C - Overview
- C - Environment Setup
- C - Program Structure
- C - Basic Syntax
- C - Data Types
- C - Variables
- C - Constants
- C - Storage Classes
- C - Operators
- C - Decision Making
- C - Loops
- C - Functions
- C - Scope Rules
- C - Arrays
- C - Pointers
- C - Strings
- C - Structures
- C - Unions
- C - Bit Fields
- C - Typedef
- C - Input & Output
- C - File I/O
- C - Preprocessors
- C - Header Files
- C - Type Casting
- C - Error Handling
- C - Recursion
- C - Variable Arguments
- C - Memory Management
- C - Command Line Arguments
- C Programming useful Resources
- C - Questions & Answers
- C - Quick Guide
- C - Useful Resources
- C - Discussion
# 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 Articles
- Hash Functions and Hash Tables
- Equality Operators: == and != in C++
- Relational and Logical Operators in C
- Increment ++ and decrement -- Operators in C++
- Relational and comparison operators in C++
- Operators, Types and Variables in C#
- Increment and Decrement Operators in C#
- C++ Relational and Equality Operators
- Left Shift and Right Shift Operators in C/C++
- Ternary Operators in C/C++
- Unary operators in C/C++
- C++ Operators with Precedence and Associativity
- C# Bitwise and Bit Shift Operators
- What are C operators and Punctuators?
- Bitwise Operators in C

Advertisements