program to print the value ,address and size of different type of variable.

 // Program to print the value ,address ,size of different type of variable.

#include <stdio.h>
#include <conio.h>

int main()
{
    int a, l, m, n; \\size of datatype is positive integer
    char b;
    float c;
    printf("Enter the value of a,b,c:\n");
    scanf("%d %c%f", &a, &b, &c);\\ Gap for char
    printf("Address of variable a is %u\n", &a);
    printf("Address of variable b is %u\n", &b);
    printf("Address of variable c is %u\n", &c);
    l = sizeof(a);
    m = sizeof(b);
    n = sizeof(c);
    printf("Size of variable a is %d\n", l);
    printf("Size of variable b is %d\n", m);
    printf("Size of variable c is %d\n", n);
    return 0;
}
Output
Enter the value of a,b,c: 8 a 5.5 Address of variable a is 6422224 Address of variable b is 6422223 Address of variable c is 6422216 Size of variable a is 4 Size of variable b is 1 Size of variable c is 4


Comments

Popular posts from this blog

18 Amazing programs in C.