Informatică, întrebare adresată de antoniosceastlivii, 8 ani în urmă

Folosind operatorul sizeof afişaţi câtă memorie se rezervă pentru fiecare tip de date (char, signed char, unsigned char, short, signed short, unsigned short, int, signed int, unsigned int, long int, long signed int, long unsiged int, float, double, long double). In limbajul C, va rog))))

Răspunsuri la întrebare

Răspuns de rares256
1

Răspuns:

#include <iostream>

using namespace std;

int main()

{

   cout << "CHAR :" << sizeof(char) << '\n';

   cout << "SIGNED CHAR :" << sizeof(signed char) << '\n';

   cout << "UNSIGNED CHAR :" << sizeof(unsigned char) << '\n';

   cout << "SHORT :" << sizeof(short) << '\n';

   cout << "SIGNED SHORT :" << sizeof(signed short) << '\n';

   cout << "UNSIGNED SHORT :" << sizeof(unsigned short) << '\n';

   cout << "INT :" << sizeof(int) << '\n';

   cout << "SIGNED INT :" << sizeof(signed int) << '\n';

   cout << "UNSIGNED INT :" << sizeof(unsigned int) << '\n';

   cout << "LONG INT :" << sizeof(long int) << '\n';

   cout << "LONG SIGNED INT :" << sizeof(long signed int) << '\n';

   cout << "LONG UNSIGNED INT :" << sizeof(long unsigned int) << '\n';

   cout << "FLOAT :" << sizeof(float) << '\n';

   cout << "DOUBLE :" << sizeof(double) << '\n';

   cout << "LONG DOUBLE :" << sizeof(long double) << '\n';

}

Explicație:

Alte întrebări interesante