Write a program to find the number of bytes occupied by various data types using the sizeof operator

 Write a program to find the number of bytes occupied by various data types using the sizeof operator?


int  a;

 

char b;

float  c;  long

 

int d; bool e;

unsigned int j;

 

unsigned long k;

Write a program to find the number of bytes occupied by various data types using the sizeof operator


SOLUTION :

#include<iostream>

using namespace std;

int main ()

{

   cout<<"Number of bytes occupied by Bool :"<<sizeof(bool)<<endl;

   cout<<"Number of bytes occupied by Char :"<<sizeof(char)<<endl;

   cout<<"Number of bytes occupied by Short:"<<sizeof(short)<<endl;

   cout<<"Number of bytes occupied by Long :"<<sizeof(long)<<endl;

   cout<<"Number of bytes occupied by Float:"<<sizeof(float)<<endl;

   cout<<"Number of bytes occupied by Double:"<<sizeof(double)<<endl;

   cout<<"Number of bytes occupied by Long Double:"<<sizeof(long double)<<endl;

   cout<<"Number of bytes occupied by Int:"<<sizeof(int)<<endl;

   cout<<"Number of bytes occupied by Unsigned Int:"<<sizeof(unsigned int)<<endl;

   cout<<"Number of bytes occupied by Long Long:"<<sizeof(long long)<<endl;

   return 0;


}



 random/hot-posts 

PROGRAMMING QUESTIONS/feat-big

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.