Special Operators In C
Special Operators
- The Comma Operator
- Type cast Operator
- Reference operator or Address Operater ("&")
- Dereference operator ("*") or Pointer Operater
- Double Pointer operator ("**")
- sizeof operator
The Comma Operator
- The Comma operator can be used to link the related expressions together.
Example For Comma Operator
Comma Operator In for Loops
for(i=0,j=1;i>10:i++,j++)
Comma Operator In while Loops
While(c<10,c--)
Type cast Operator
Syntax:
( type )
Explanation
- converts a to the specified type.
- Note that the use of a parenthesized type in a method declaration or definition is not an example of the use of the type cast operator.
Example For Type Cast Operator
float s= 12.5; int a;
a = (int) s;
now a value is 12.
Reference operator or Address Operater ("&")
The reference operator noted by ampersand ("&"), is also a unary operator in c languages that uses for assign address of the variables. It returns the pointer address of the variable. This is called "referencing" operater.
Syntax
data_type x;
data_type *pt;
pt = &x
Example : Reference operator ("&") and Dereference operator ("*")
Dereference operator ("*") or Pointer Operater
The dereference operator or indirection operator, noted by asterisk ("*"), is also a unary operator in c languages that uses for pointer variables. It operates on a pointer variable, and returns l-value equivalent to the value at the pointer address. This is called "dereferencing" the pointer.
data_type *pt;
Example : Reference operator ("&") and Dereference operator ("*")
Double Pointer operator ("**")
Double Pointer is, that double pointer points to another pointer variable address.
data_type **pt;
sizeof operator
sizeof returns the size of a variable or datatype
sizeof (data_type)
Read More Articles
- Use of getch(),getche() and getchar() in C
- Switch Case Statement Example Program In C Programming Language
- C Character Set
- Convert a Floating-point value to an Integer in C
- Data Input and Output gets and puts Example Program In C
- Special Operators In C
- Pointer Representation and Pointer Example Programs
- C Data Input and Data Output
- Simple While Loop Example Program In C Programming Language
- Data Output printf and putchar Example Program In C
- C Introduction
- C Operators
- Storage Classes In C
- C Pointers
- File Management
- C Identifiers
- Loop Control Statements
- Hello World - Simple C Program
- C Array
- Single Character Output Function : putchar()
- C Reserve Words
- C Specific Properties and Implementation
- If else Statement Example Program In C Programming Language
- If Statement Example Program In C Programming Language
- Confusing Array in C ( Array Representation and Initialization )