Files
  • main.cpp
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Include the standard (STD) 
//  input and output (IO) header
#include <stdio.h>

// main function
// Returns: Integer
int main() {
  
  // Integer array
  int numberArray[6] = {1, 2, 3, 4, 5, 6};
  
  // Float array
  float decimalArray[3] = {0.5, 6.5, 8.8};

  // Character array
  char stringArray[] = "Hello, world!";

  // Multidimensional array
  int mdArray[3][2] = { {1,2}, {3,4}, {5,6} };
  
  // Use the printf() function
  // %i: Integer
  // %f: Float
  // %c: Character
  printf("Second Positions: %i %f %c %i \n",
    numberArray[2],
    decimalArray[2],
    stringArray[2],
    mdArray[2][0]
  );

  // Return 0
  return 0;

}
gcc version 4.6.3