Wednesday, August 26, 2020

9.2.1 Special C Operators

These are special operators in C Language.
  • The Comma Operator
  • Type cast Operator
  • Reference operator or Address Operater ("&")
  • Dereference operator ("*") or Pointer Operater
  • Double Pointer operator ("**")
  • sizeof operator
Below are the some important special operators in c language

Operators

 

Description

 

sizeof (var_name)

This operator returns the size of the variables in memory.

 

&

This returns the memory address of operator variables.

 

*

This operator returns the pointer of the variable.


EXAMPLE :-


// Special operators in C.
#include <stdio.h>
int main()
{
int p;
float q;
double r;
char s;
printf("Size of int=%lu bytes\n",sizeof(p));
printf("Size of float=%lu bytes\n",sizeof(q));
printf("Size of double=%lu bytes\n",sizeof(r));
printf("Size of char=%lu byte\n",sizeof(s));

return 0;
}


OUTPUT

Size of int = 4 bytes Size of float = 4 bytes Size of double = 8 bytes Size of char = 1 byte



No comments:

Post a Comment

Please do not any spam link in Comment Box