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
Last revisionBoth sides next revision
cpp:basic_data_types [2021/04/25 14:37] – [Δήλωση και αρχικοποίηση μεταβλητών] gthanoscpp:basic_data_types [2021/04/25 15:02] – [Αυτόματη εξαγωγή τύπου δεδομένων] gthanos
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.txt · Last modified: 2021/04/25 14:02 (external edit)