title: size of basic data types in C
body: <p>I have a sample program that I copied from some website.</p>
  
  <pre><code>int main(void)
  {
     int answer;
     short x = 1;
     long y = 2;
     float u = 3.0;
     double v = 4.4;
     long double w = 5.54;
     char c = 'p';
  
     typedef enum
     {
        kAttributeInvalid,
        kBooleanAttributeActive,
        kBooleanAttributeAlarmSignal,
        kBooleanAttributeAlign64,
        kBooleanAttributeAutoNegotiationComplete,
     }codes_t;
  
    /* __DATE__, __TIME__, __FILE__, __LINE__ are predefined symbols */
    #if 0
    printf("Date : %s\n", __DATE__);
    printf("Time : %s\n", __TIME__);
    printf("File : %s\n", __FILE__);
    printf("Line : %d\n", __LINE__);
    #endif
  
    /* The size of various types */
    printf("The size of int         %zu\n", sizeof(answer));
    printf("The size of short       %zu\n", sizeof(x));
    printf("The size of long        %zu\n", sizeof(y));
    printf("The size of float       %zu\n", sizeof(u));
    printf("The size of double      %zu\n", sizeof(v));
    printf("The size of long double %zu\n", sizeof(w));
    printf("The size of char        %zu\n", sizeof(c));
    printf("The size of enum        %zu\n", sizeof(codes_t));
  
    return 0;
  }
  </code></pre>
  
  <p>I ran this program and the output that I got is as follows.</p>
  
  <pre><code>The size of int         4
  The size of short       2
  The size of long        8
  The size of float       4
  The size of double      8
  The size of long double 16
  The size of char        1
  The size of enum        4
  </code></pre>
  
  <p>I am running this on a linux PC that is running 64-bit Ubuntu.My question is if I were to run the same program on a 32-bit machine will I see different results.Or in other words does the size of the basic data types depend on</p>
  
  <ol>
  <li>processor</li>
  <li>Operating System</li>
  <li>anything else</li>
  </ol>