- C Programming Tutorial
- C - Home
- Basics of C
- C - Introduction
- C - Features
- C - Basics
- C - History
- C - Structure of C Program
- C - Program Structure
- C - Hello World
- C - Compilation Process
- C - Comments
- C - Tokens
- C - Keywords
- C - Identifiers
- C - User Input
- C - Basic Syntax
- C - Data Types
- C - Variables
- C - Integer Promotions
- C - Type Conversion
- C - Type Casting
- C - Booleans
- Constants and Literals in C
- C - Constants
- C - Literals
- C - Escape sequences
- C - Format Specifiers
- Operators in C
- C - Operators
- C - Arithmetic Operators
- C - Relational Operators
- C - Logical Operators
- C - Bitwise Operators
- C - Assignment Operators
- C - Unary Operators
- C - Increment and Decrement Operators
- C - Ternary Operator
- C - sizeof Operator
- C - Operator Precedence
- C - Misc Operators
- Decision Making in C
- C - Decision Making
- C - if statement
- C - if...else statement
- C - nested if statements
- C - switch statement
- C - nested switch statements
- Loops in C
- C - Loops
- C - While loop
- C - For loop
- C - Do...while loop
- C - Nested loop
- C - Infinite loop
- C - Break Statement
- C - Continue Statement
- C - goto Statement
- Functions in C
- C - Functions
- C - Main Function
- C - Function call by Value
- C - Function call by reference
- C - Nested Functions
- C - Variadic Functions
- C - User-Defined Functions
- C - Callback Function
- C - Return Statement
- C - Recursion
- Scope Rules in C
- C - Scope Rules
- C - Static Variables
- C - Global Variables
- Arrays in C
- C - Arrays
- C - Properties of Array
- C - Multi-Dimensional Arrays
- C - Passing Arrays to Function
- C - Return Array from Function
- C - Variable Length Arrays
- Pointers in C
- C - Pointers
- C - Pointers and Arrays
- C - Applications of Pointers
- C - Pointer Arithmetics
- C - Array of Pointers
- C - Pointer to Pointer
- C - Passing Pointers to Functions
- C - Return Pointer from Functions
- C - Function Pointers
- C - Pointer to an Array
- C - Pointers to Structures
- C - Chain of Pointers
- C - Pointer vs Array
- C - Character Pointers and Functions
- C - NULL Pointer
- C - void Pointer
- C - Dangling Pointers
- C - Dereference Pointer
- C - Near, Far and Huge Pointers
- C - Initialization of Pointer Arrays
- C - Pointers vs. Multi-dimensional Arrays
- Strings in C
- C - Strings
- C - Array of Strings
- C - Special Characters
- C Structures and Unions
- C - Structures
- C - Structures and Functions
- C - Arrays of Structures
- C - Self-Referential Structures
- C - Lookup Tables
- C - Dot (.) Operator
- C - Enumeration (or enum)
- C - Structure Padding and Packing
- C - Nested Structures
- C - Anonymous Structure and Union
- C - Unions
- C - Bit Fields
- C - Typedef
- File Handling in C
- C - Input & Output
- C - File I/O (File Handling)
- C Preprocessors
- C - Preprocessors
- C - Pragmas
- C - Preprocessor Operators
- C - Macros
- C - Header Files
- Memory Management in C
- C - Memory Management
- C - Memory Address
- C - Storage Classes
- Miscellaneous Topics
- C - Error Handling
- C - Variable Arguments
- C - Command Execution
- C - Math Functions
- C - String Functions
- C - Static Keyword
- C - Random Number Generation
- C - Command Line Arguments
C Programming - C Special Characters
![]() Share with a Friend |
C Programming - C Special Characters
C Special Characters
Special characters in C are symbols that have predefined meanings and are used for specific purposes within a program. These characters are part of the syntax of the C language and help in writing, structuring, and controlling the flow of a program.
List of Special Characters in C
| Character | Description | |
|---|---|---|
| # |
Preprocessor directive symbol |
|
| " |
Double quotation mark (string literal) |
|
| ' |
Single quotation mark (character literal) |
|
| \ |
Backslash (used for escape sequences) |
|
| { } |
Curly braces (block of code) |
|
| [ ] |
Square brackets (array indexing) |
|
| ( ) |
Parentheses (function calls, grouping expressions) |
|
| , |
Comma (separates items in a list) |
|
| ; |
Semicolon (statement terminator) |
|
| : |
Colon (used in labels and ternary operator) |
|
| . |
Dot (access structure members) |
|
| -> |
Arrow operator (access structure members through pointers) |
|
| * |
Asterisk (pointer declaration or multiplication) |
|
| & |
Ampersand (address-of operator) |
|
| = |
Assignment operator |
|
| + - |
Plus and minus (arithmetic operators) |
|
| ! |
Logical NOT operator |
|
| ~ |
Bitwise NOT operator |
|
| ? |
Ternary conditional operator |
|
| \\ |
Escape sequence for backslash |
|
| % |
Modulus operator |
|
| ` | ||
| & && |
Bitwise AND, Logical AND operators |
|
| < > |
Relational operators (less than, greater than) |
|
| / |
Division operator |
|
| ^ |
Bitwise XOR operator |
|
| " |
Double quotes (string delimiters) |
Usage Examples
- Preprocessor Directive (#):
C
#include <stdio.h>
- Escape Sequences (\):
C
printf("Hello\nWorld"); // Outputs: Hello (new line) World
- Curly Braces ({}):
C
if (x > 0) {
printf("Positive");
}
- Square Brackets ([]):
C
int arr[5] = {1, 2, 3, 4, 5};
- Parentheses (()):
C
int sum = (a + b) * c;
- Semicolon (;):
C
printf("End of statement");
- Ternary Operator (? :):
C
int max = (a > b) ? a : b;
- Dot and Arrow Operators (. and ->):
C
struct Point {
int x, y;
} p1;
p1.x = 10; // Using dot operator
struct Point *ptr = &p1;
ptr->y = 20; // Using arrow operator
- Assignment and Arithmetic Operators:
C
int x = 5;
x += 10; // Equivalent to x = x + 10;
Escape Sequences
Escape sequences are special characters prefixed with a backslash (\) and used to represent certain non-printable or control characters.
| Escape Sequence | Meaning |
|---|---|
| \n |
Newline |
| \t |
Horizontal tab |
| \b |
Backspace |
| \r |
Carriage return |
| \\ |
Backslash (\) |
| \' |
Single quote (') |
| \" |
Double quote (") |
| \0 |
Null character |
Conclusion
Special characters in C play a crucial role in the language's syntax and functionality. Mastering their use allows you to write clear, concise, and functional code. Always be cautious with their usage to avoid syntax errors.
