Ask Question

write a C program the prints out the size of variables with the following C data types - int, long, unsigned, long long, double, float, char, and double

+4
Answers (1)
  1. 30 January, 22:46
    0
    C program for finding size of different data types

    #include

    //driver function

    int main ()

    {

    int a; / /declaring a of type int

    float b; / /declaring b of type float

    double c; / /declaring c of type double

    char d; / /declaring d of type char

    long e; / /declaring e of type long

    long long f; / /declaring f of type longlong

    unsigned g; / /declaring g of type unsigned

    / / Sizeof operator is used to evaluate the size of a variable

    printf (" int data type contains: %lu bytes/n", sizeof (a)); /*Finding size of int * /

    printf ("float data type contains : %lu bytes/n", sizeof (b)); /*Finding size of float * /

    printf ("double data type contains: %lu bytes/n", sizeof (c)); /*Finding size of double * /

    printf ("char data type contains: %lu byte/n", sizeof (d)); /*Finding size of char * /

    printf ("long data type contains: %lu byte/n", sizeof (e)); /*Finding size of long* / printf ("longlong data type contains: %lu byte/n", sizeof (f)); /*Finding size of longlong * /

    printf ("unsigned data type contains: %lu byte/n", sizeof (g)); / *Finding size of unsigned * /

    return 0;

    }

    Output

    int data type contains: 4 bytes

    float data type contains : 4 bytes

    double data type contains: 8 bytes

    char data type contains: 1 byte

    long data type contains: 8 byte

    longlong data type contains: 8 byte

    unsigned data type contains: 4 byte
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “write a C program the prints out the size of variables with the following C data types - int, long, unsigned, long long, double, float, ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers