Computer Science & C Programming


C Programming

Next, data are stored into variable that have a "type" representing their "nature" and their memory size.

  // declare and initialize a character variable	
  char c = 'X';
  printf("%c",c);
  // sample integer variable
  int i = (int)c; // ascii code
  printf("%i",i); // 88
  // sample array of characters
  char s[4] = {' ','X','O','\0'};
  printf("%s",s);

Nb. Variable can be bounds into a { subprogram }, or shared between all the subprogram.