There are lot more operators in C which are not categorized into any group those operators are special operators.
Operator | Meaning | Description |
---|---|---|
, | Comma Operator | This can be used to link the related expression together. |
sizeof | Sizeof Operator | A compile time operator returns the number of bytes the operand occupies. For example: number_byte = sizeof(num). |
& | Reference | Gives the address of the normal variable. |
* | Dereference | Gives the content of the pointer variable. |
. | Dot Operator | Used to access the member of a normal structure variable. |
-> | Arrow Operator | Used to access the member of a pointer structure variable. |
Example:
/*
special operators
*/
#include <stdio.h>
int main(){
// comma operator
int x = 10, y, z, sizeofX;
int *ptr;
ptr = &x;
// structure
struct student {
int roll;
} s1, *sp1;
sp1 = &s1;
sizeofX = sizeof(x);
printf("Size of x = %d\n", sizeofX);
printf("Address of x = %p\n", &x);
printf("Content of ptr = %d\n", *ptr);
s1.roll = 11;
printf("Roll of s1 = %d\n", s1.roll);
printf("Roll of *sp1 = %d\n", sp1->roll);
return 0;
}
Expected output:
Size of x = 4
Address of x = 000000000061FE08
Content of ptr = 10
Roll of s1 = 11
Roll of *sp1 = 11