Search
 
SCRIPT & CODE EXAMPLE
 

CPP

C++ program to sizes of data types

// C++ program to sizes of data types
#include <iostream>
#include <limits.h>
using namespace std;
 
int main()
{
    cout << "Size of char : " << sizeof(char) << " byte"
         << endl;
   
  cout << "char minimum value: " << CHAR_MIN << endl;
   
   
  cout << "char maximum value: " << CHAR_MAX << endl;
   
   
  cout << "Size of int : " << sizeof(int) << " bytes"
         << endl;
     
  cout << "Size of short int : " << sizeof(short int)
         << " bytes" << endl;
     
  cout << "Size of long int : " << sizeof(long int)
         << " bytes" << endl;
     
  cout << "Size of signed long int : "
         << sizeof(signed long int) << " bytes" << endl;
     
  cout << "Size of unsigned long int : "
         << sizeof(unsigned long int) << " bytes" << endl;
     
  cout << "Size of float : " << sizeof(float) << " bytes"
         << endl;
    
  cout << "Size of double : " << sizeof(double)
         << " bytes" << endl;
     
  cout << "Size of wchar_t : " << sizeof(wchar_t)
         << " bytes" << endl;
 
    return 0;
}
Comment

C++ datatype size

// Following is the example, which will produce correct size of various data types on your computer.
  
#include <iostream>
using namespace std;
  
int main() 
{
    cout << "Size of char : " << sizeof(char) << endl;
    cout << "Size of int : " << sizeof(int) << endl;
      
    cout << "Size of long : " << sizeof(long) << endl;
    cout << "Size of float : " << sizeof(float) << endl;
      
    cout << "Size of double : " << sizeof(double) << endl;
      
      return 0;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: print fps sfml 
Cpp :: program to swap max and min in matrix 
Cpp :: c++ delay 
Cpp :: c++ if statement 
Cpp :: how to traverse through vector pair 
Cpp :: c++ map lookup 
Cpp :: flutter single instance app 
Cpp :: accumulate in cpp 
Cpp :: c++ formatting 
Cpp :: volumeof a sphere 
Cpp :: read a whole line from the input 
Cpp :: cin does not wait for input 
Cpp :: balanced brackets in c++ 
Cpp :: initialize a vector with same values 
Cpp :: unordered_map c++ 
Cpp :: __builtin_popcount 
Cpp :: C++ vector structure 
Cpp :: options select from array 
Cpp :: stack data structure c++ 
Cpp :: enum in c++ 
Cpp :: c++ last element of vector 
Cpp :: queue cpp 
Cpp :: Initialize Vector Iterator with end() function 
Cpp :: why exceptions can lead to memory leaks 
Cpp :: graph colouring 
Cpp :: uint16_t does not name a type 
Cpp :: c++ camera capture 
Cpp :: setFontSize QT 
Cpp :: progress bar custom color c++ buider 
Cpp :: txt to pdf CPP 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =