سطح: مبتدی

این کد پس از اجرا مقدار حافظه ای که توسط متغیر های مشخص شده اشغال میشود را به ما نشان می دهد.
کد سادست و توضیحات لازم بین کد ها ذکر شده.
کامپایلر برنامه Visual C++‎‎‎ 2012


#include "stdafx.h"
#include <iostream> //baraye in estefade mishe ke betunim az dastoorati manande cout va cin estefade konim.
using namespace std; //baraye ine ke az dastoorati mesle (std::cout) beshe be in shekl estefade kard: (cout)
int main()
{
cout << "The size of an int is:\t\t" << sizeof(int) <<" bytes.\n";
cout << "The size of a short int is:\t" << sizeof(short) <<" bytes.\n";
cout << "The size of a long int is:\t" << sizeof(long) <<" bytes.\n";
cout << "The size of a char is:\t\t" << sizeof(char) <<" bytes.\n";
cout << "The size of a float is:\t\t" << sizeof(float) <<" bytes.\n";
cout << "The size of a double is:\t" << sizeof(double) <<" bytes.\n";
cin.get(); //age in dastoor nabashe barname be mahze ejra va anjame dastoorat, kharej mishe.
}

هرگونه مشکل یا سوالی بود در خدمتم.