• Tutorials
  • DSA
  • Data Science
  • Web Tech
  • Courses
June 07, 2022 |5.1K Views

C++ Program to Find the Size of int, float, double and char

Description
Discussion


In this video, we will see a C++ program to find the size of int, float, double, and char.

To find the size of the four variables:

1. The four types of variables are defined in integerType, floatType, doubleType and charType.
2. sizeof() operator is used to calculate the size of the variables. Sizeof is an important operator in the C and C++.

Basically, It is a compile-time unary operator which can be used to compute the size of its operand. The result of sizeof is of the unsigned integral type which is generally denoted by size_t. A sizeof can be applied to any data type, including primitive types like integer types, floating-point types, pointer types, or compound data types such as Structure, union etc. When sizeof() is used with the data types such as int, float, char… etc it simply returns the amount of memory allocated to that data type.

C++ Program to Find Size of int, float, double & char: https://www.geeksforgeeks.org/c-cpp-program-to-find-the-size-of-int-float-double-and-char/