Separators in C Programming Language
Notes:
Separators in C programming language:
- Separators in a programming language are used to separate program elements from one another.
Comma Separator:
- is used to separate identifiers from one another
- is used to separate expressions from one another
- is used to separate function arguments from another etc.
Ex:
int a=10, b=20, c=a+b ;
int x, y ,z;
printf(“%d + %d = %d\n”, a, b, c);
Semicolon Separator:
- is used to separate C statements from one another
Ex:
int a=10, b=20, c=a+b ;
int x, y ,z ;
printf(“%d + %d = %d\n”, a, b, c);
Block Separator:
- is used to separate statements appearing inside the block from the statements appearing outside the block
Ex:
If(a==10)
{
printf(“a is equal to 10”);
}
printf(“Statement outside if block”);
Square Brackets:
- are used to separate array name from its size
- are used to separate array name from the index of an element
Ex:
char name[10] = “Manjunath”;
printf(“Char at 0 index= %c\n”, name[0] );
Note: Space is also considered as a separator; which is used to separate one program element from the other and increase the code readability.