User Tools

Site Tools


cpp:basic_data_types

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
cpp:basic_data_types [2021/04/25 14:37] – [Δήλωση και αρχικοποίηση μεταβλητών] gthanoscpp:basic_data_types [Unknown date] (current) – external edit (Unknown date) 127.0.0.1
Line 74: Line 74:
   long b(3);              // initial value: 3  sizeof long   long b(3);              // initial value: 3  sizeof long
  
-  auto result = a + b;    // compiler automatically extracts the result'type. +  auto result = a + b;    // compiler automatically extracts the variable type. 
-  cout << result << endl;+   
 +  cout << "sizeof(result): " << sizeof(result) << endl; 
 +  cout << "sizeof(int): " << sizeof(int) << endl; 
 +  cout << "sizeof(long): " << sizeof(long) << endl;
  
   return 0;   return 0;
Line 93: Line 96:
   decltype(b) result;   decltype(b) result;
  
-  result = a + b+  cout << "sizeof(result): " << sizeof(result) << endl
-  cout << result << endl;+  cout << "sizeof(int): " << sizeof(int) << endl; 
 +  cout << "sizeof(long): " << sizeof(long) << endl;
      
   return 0;   return 0;
cpp/basic_data_types.1619361425.txt.gz · Last modified: 2021/04/25 13:37 (external edit)