Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
What are the special symbols in C language?
In C programming language, special symbols have specific meanings and are essential for writing syntactically correct programs. This language provides low-level access to memory and is known for its performance and efficiency.
The C language includes a character set of English alphabets (a-z, A-Z), digits (0-9), and special characters with specific meanings. Some special characters are operators, while combinations like "
" are escape sequences. In C, symbols are used to perform special operations −
Syntax
[] () {} , ; * = # : . -> + - / % < > ! & | ^ ~ ? " ' \
Common Special Symbols in C Programming
Let's understand their definitions and usage −
-
Brackets [] − Used for array element reference, indicating single and multidimensional subscripts.
-
Parentheses () − Used for function calls and function parameters.
-
Braces {} − Indicate the start and end of a code block containing multiple executable statements.
-
Comma (,) − Used to separate multiple statements, parameters in function calls, and variable declarations.
-
Semicolon (;) − Statement terminator that indicates the end of one logical entity. Each statement must end with a semicolon.
-
Asterisk (*) − Used for pointer declaration, dereferencing, and multiplication operator.
-
Assignment operator (=) − Used for assigning values to variables.
-
Preprocessor (#) − Used by the compiler to transform your program before compilation starts (macros, includes).
-
Arrow operator (->) − Used to access members of a structure through a pointer.
Example: Structure and Pointer Usage
This program demonstrates special characters like braces {}, parentheses (), and the arrow operator -> −
#include <stdio.h>
struct Point {
int x, y;
};
void printPoint(struct Point *p) {
printf("Point: (%d, %d)<br>", p->x, p->y);
}
int main() {
struct Point p = {10, 20};
printPoint(&p);
return 0;
}
Point: (10, 20)
Complete List of Special Symbols
The table below shows special symbols and their meanings in C programming −
| Symbol | Name | Usage |
|---|---|---|
| ~ | Tilde | Bitwise NOT operator |
| ! | Exclamation mark | Logical NOT operator |
| # | Hash/Number sign | Preprocessor directive |
| % | Percent sign | Modulo operator, format specifier |
| ^ | Caret | Bitwise XOR operator |
| & | Ampersand | Address-of operator, bitwise AND |
| * | Asterisk | Pointer declaration, dereference, multiplication |
| + | Plus sign | Addition operator |
| - | Minus sign | Subtraction operator |
| = | Equal sign | Assignment operator |
| / | Slash | Division operator |
| | | Vertical bar | Bitwise OR operator |
| ? | Question mark | Ternary conditional operator |
| : | Colon | Used in ternary operator, labels |
Example: Arithmetic Operations
This program demonstrates various arithmetic operators and special symbols −
#include <stdio.h>
int main() {
int x = 10, y = 15;
int sum, diff, prod, quot, rem;
sum = x + y; /* Addition */
diff = x - y; /* Subtraction */
prod = x * y; /* Multiplication */
quot = y / x; /* Division */
rem = y % x; /* Modulo */
printf("Sum: %d<br>", sum);
printf("Difference: %d<br>", diff);
printf("Product: %d<br>", prod);
printf("Quotient: %d<br>", quot);
printf("Remainder: %d<br>", rem);
return 0;
}
Sum: 25 Difference: -5 Product: 150 Quotient: 1 Remainder: 5
Conclusion
Special symbols in C are fundamental building blocks that define program structure, operations, and data manipulation. Understanding their proper usage is essential for writing efficient and syntactically correct C programs.
