size_of_data_type.cpp
Server-Architecture-Firmware/size_of_data_type.cpp
#include <iostream>
#include <string>
#include <typeinfo>
using namespace std;
int main() {
int x = 47385;
cout<<sizeof(x)<<endl;
cout << "Type of x : " << typeid(x).name() << endl;
cout<<"Size of int "<<sizeof(int)<<endl;
const char* greeting = "Hello, world!";;
cout << "Size of *greeting "<< sizeof(*greeting)<<endl;
cout << "Size of greeting "<< sizeof(greeting)<<endl;
cout << "Type of greeting : " << typeid(greeting).name() << endl;
cout << "Size of char "<<sizeof(char)<<endl;
return 0;
}
Articles liés
Armstrong.cpp
Armstrong.cpp — cpp source code from the Server-Architecture-Firmware learning materials (Server-Architecture-Firmware/Armstrong.cpp).
Lire l'article →MaxOfTwo.cpp
MaxOfTwo.cpp — cpp source code from the Server-Architecture-Firmware learning materials (Server-Architecture-Firmware/MaxOfTwo.cpp).
Lire l'article →RTTI.cpp
RTTI.cpp — cpp source code from the Server-Architecture-Firmware learning materials (Server-Architecture-Firmware/RTTI.cpp).
Lire l'article →console_input.cpp
console_input.cpp — cpp source code from the Server-Architecture-Firmware learning materials (Server-Architecture-Firmware/console_input.cpp).
Lire l'article →function.cpp
function.cpp — cpp source code from the Server-Architecture-Firmware learning materials (Server-Architecture-Firmware/function.cpp).
Lire l'article →main.cpp
main.cpp — cpp source code from the Server-Architecture-Firmware learning materials (Server-Architecture-Firmware/main.cpp).
Lire l'article →