Special symbols (Separators)
🔷 Special Symbols in C (Specific Symbols) in Detail
Special Symbols are characters that have a fixed meaning in C programming.
They are used to perform different operations like grouping, separating, defining blocks, accessing data, etc.
💫List of Special Symbols in C Language
Symbol Name Function / Use
() Parentheses Used in functions and expressions
{} Curly Braces Define the beginning and end of a block
[] Square
Brackets Used for arrays
; Semicolon. End of a statement
, Comma Separate variables
. Dot Access structure members
-> Arrow Access structure using pointer
& Ampersand Address of variable
* Asterisk Pointer declaration
# Hash Preprocessor directive
: Colon Used in labels and conditional operator
? Question Mark Used in ternary operator
' ' Single Quotes Character constant
" " Double Quotes String constant
\ Backslash Escape sequence
// Double Slash Single line comment
/* */ Slash-Asterisk Multi-line comment
🔹 Explanation with Example
1. Semicolon ;
Used to terminate a statemente
Example:
C
int a = 10;
2. Curly Braces { }
Used to define a block of code
Example:
C
{
printf("Hello");
}
3. Parentheses ( )
Used in functions or conditions.
Example:
C
if(a > 5)
4. Square Brackets [ ]
Used in array declaration.
Example:
C
int arr[5];
5. Hash #
Used in preprocessor directives.
Example:
C
#include<stdio.h>
6. Backslash \
Used in escape sequences.
Example:
C
printf("Hello\nWorld");
7. Arrow ->
Used to access structure members using pointer.
Example:
C
ptr->age;
🔸 Importance of Special Symbols
- Help in program structure
- Define statements and blocks
- Used in memory access
- Help in function calling
- Necessary for arrays & pointers
- Used in preprocessor directives
Comments
Post a Comment