Miscellaneous Operators in C

Besides the others operators as described in the previous several tutorials, there are some few others important operators in C programming language. i,e. sizeof, &, *,  ? :.

Now, let’s see the operators in C programming language:

Operator Description Example
sizeof() Returns the size of a variable. sizeof(a), where a is integer, will return 4.
& Returns the address of a variable. &i; returns the actual address of the variable.
* Pointer to a variable. *i; indicate a pointer variable i.
? : Conditional expression. i==1?”Y”:”N”; If condition is true then value Y otherwise value N.

C program code with misc operators:

void main()

     int i = 5;
     int *ptr;
     printf("Address of i is %d.\n", &i);
     printf("Value of i is %d.\n", i);
     printf("Address of ptr is %d.\n", ptr);
     printf("Value of *ptr is %d.\n", *ptr);



Address of i is 6422036.
Value of i is 5.
Address of ptr is 6422036.
Value of *ptr is 5.

Click Operators in C to know other operators in C programming language.

In this tutorial, I have shown misc operators in C. Hope you have enjoyed the tutorial. If you want to get updated, like my facebook page http://www.facebook.com/freetechtrainer and stay connected.

Add a Comment