Created
February 17, 2017 02:12
-
-
Save Adals20/491f77eb40d7c71d42f7932701318fc8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <stdio.h> | |
using namespace std; | |
main() | |
{ /* PROGRAM TO PRINT OUT SPACE RESERVED FOR VARIABLES */ | |
char c; | |
short s; | |
int i; | |
unsigned int ui; | |
unsigned long int ul; | |
float f; | |
double d; | |
long double ld; | |
cout << endl | |
<< "The storage space for each variable type is:" | |
<< endl; | |
printf("char: \t\t\t%d bits\n",int(sizeof(c)*8)); // \t means tab | |
printf("short: \t\t\t%d bits",sizeof(s)*8); cout << endl; | |
printf("int: \t\t\t%d bits",sizeof(i)*8); cout << endl; | |
printf("unsigned int: \t\t%d bits",sizeof(ui)*8); cout << endl; | |
printf("unsigned long int: \t%d bits",sizeof(ul)*8); cout << endl; | |
printf("float: \t\t\t%d bits",sizeof(f)*8); cout << endl; | |
printf("double: \t\t%d bits",sizeof(d)*8); cout << endl; | |
printf("long double: \t\t%d bits",sizeof(ld)*8); cout << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment