Size of Operator - Devbhoomi

FREE JOB ALERT & ONLINE TUTORIALS

Hot

Post Top Ad

Sunday 5 November 2017

Size of Operator

C provides a compiler-time unary operator called sizeof that can be used to compute the size of any object.
The expression such as:
  • sizeof object
  • sizeof(type name)
Example :

    #include<stdio.h>

    int main()
    {

    printf("size of int in byte : %d\n", sizeof(int));
    printf("size of char in byte %d\n", sizeof(char));
    printf("size of float in byte %d", sizeof(float));

    return 0;
    }

Output :
 size of int in byte :  4
 size of char in byte 1
 size of float in byte 4

No comments:

Post a Comment

Post Top Ad