Q:

Write a program to print the size of each of the built-in types

0

Write a program to print the size of each of the built-in types.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include <iostream>

int main() {
  std::cout << "char        " << sizeof(char) << std::endl;
  std::cout << "wchar_t     " << sizeof(wchar_t) << std::endl;
  std::cout << "char16_t    " << sizeof(char16_t) << std::endl;
  std::cout << "char32_t    " << sizeof(char32_t) << std::endl;
  std::cout << "short       " << sizeof(short) << std::endl;
  std::cout << "int         " << sizeof(int) << std::endl;
  std::cout << "long        " << sizeof(long) << std::endl;
  std::cout << "long long   " << sizeof(long long) << std::endl;
  std::cout << "float       " << sizeof(float) << std::endl;
  std::cout << "double      " << sizeof(double) << std::endl;
  std::cout << "long double " << sizeof(long double) << std::endl;

  return 0;
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now