Special Operator in C

Special Operators in C:

    • Below are some of special operators that C language offers.
 S.no
Operators
Description
1
&
This is used to get the address of the variable.
Example : &a will give address of a.
2
*
This is used as pointer to a variable.
Example : * a  where, * is pointer to the variable a.
3
Sizeof ()
This gives the size of the variable.
Example : size of (char) will give us 1.

Example program for & and * operators in C:

    • In this program, “&” symbol is used to get the address of the variable and “*” symbol is used to get the value of the variable that the pointer is pointing to. 

Output:

50

Example program for sizeof() operator in C:

    • sizeof() operator is used to find the memory space allocated for each C data types.

Output:

Storage size for int data type:4
Storage size for char data type:1
Storage size for float data type:4
Storage size for double data type:8

2 comments:

  1. http://cprogrammingandandroid.blogspot.com/

    ReplyDelete
  2. #include
    main()
    {
    int * p,a;
    a=50;
    p=&a;
    printf("%d",*p);
    }

    ReplyDelete