C++ supports various types of data types, which is categorized into built-in type, derived-type, and user-defined type. Size specifies what type of data or how much memory of that type of value requires.From this, it is clear that for representing various types of data on the computer it is, indeed, necessary to have different datatypes. We know that every datatype has specific size, that is, char has size of 1 byte, integer has 2 byte float has 4 byte and so on. But, the size depends on machine architecture(32-bit, 64-bit)too. Yes, if you declare an integer variable the size would be 2-byte(on a 32-bit machine) and 4-byte(on a 64-bit machine). Same is the case with pointer variable, any type you declare as a pointer it got the memory space depend on the machine. And all the pointer would be of the same size.
Now, see the code