Sei sulla pagina 1di 1

/*1. Write a C program to print no of bytes of memory occupied by different types of variables using size operator*/ #include<stdio.h> #include<conio.

h> main() { int i; float f; double d; long int l; char ch; unsigned int u; clrscr(); printf("integer type variable occupies %d bytes of memory",sizeof(i)); printf("float type variable occupies %d bytes of memory",sizeof(f)); printf("double type variable occupies %d bytes of memory",sizeof(d)); printf("longint type variable occupies %d bytes of memory",sizeof(l)); printf("unsigned integer type variable occupies %d bytes of memory",sizeof(u)); printf("charecter type variable occupies %d bytes of memory",sizeof(ch)); } OUTPUT: integer type variable occupies 2 bytes of memory float type variable occupies 4 bytes of memory double type variable occupies 8 bytes of memory longint type variable occupies 4 bytes of memory unsignedinteger type variable occupies 2 bytes of memory charecter type variable occupies 1 bytes of memory

Potrebbero piacerti anche