Ask Question
10 November, 21:54

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

+2
Answers (1)
  1. 11 November, 00:56
    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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers