#include <stdio.h>
#include <stdlib.h>

int
main ()
{
  /*First, we define a few different kinds of variables */

  int     i = 425;
  short int j = 17;
  long int  I = -75000L;
  unsigned int u = 12;
  unsigned long int U = 444;  
  long long int k = -3453;

  float        f=19.4F;
  double       d= -95.3452;
  long double  D= -44345;


  printf ("\n \n \n Printf is the command you often use to write information to the console \n");
  printf ("while a program is running.  You can output results or diagnostic information. \n");
  printf ("A printf command can just print a character string, in quotes, but it is \n");
  printf ("most useful when you combine it with percent signs and variable \"place holders\" \n");
  printf ("that then output the values of variables \n");


  printf ("Integers: \n");
  printf ("Here are four of the output formats for integers \n");
  printf ("i  d (synonyms) x (Hex) u (unsigned) \n");

  printf ("%i    %d     %x      %u \n", i, i, i, i);
  printf ("%i    %d     %x      %u \n",  j, j, j, j);
  printf ("%i    %d     %x      %u \n",  u, u, u, u);

  printf("\n Long integers. I always forget the symbols for those \n");
  printf ("%ld  %lu \n",  I, I);

  
 
  printf ("\nFloats and Doubles \n");
  printf ("%f      %e      %g \n", f , f, f);
  printf ("%.2f    %.3e \n", f, f);
  printf ("%7.2f   %7.2e\n", f, f);
  printf ("%f  %e  %g \n", d, d, d);


  printf("\nLet's see how many bytes these things use on your system\n");

  printf("size of int = %d bytes\n", sizeof(i));
  printf("size of short int = %d bytes\n", sizeof(j));
  printf("size of long int = %d bytes\n", sizeof(I));
  printf("size of unsigned int = %d bytes\n", sizeof(u));
  printf("size of unsigned long int = %d bytes\n", sizeof(U));
  printf("size of unsigned long long int = %d bytes\n", sizeof(k));

  printf("size of float = %d bytes\n", sizeof(f));
  printf("size of double = %d bytes\n", sizeof(d));
  printf("size of long double = %d bytes\n", sizeof(D));

 `printf("size of pointer to int = %d bytes\n", sizeof(ptrToInt));


  return 0; 
  
}


/*
Local Variables:
compile-command: "gcc example-2_variable_types.c -Wall -o whatever "
End:
*/

