@UmbraSicaro/

Pointers

C++11

No description

fork
loading
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
#include <iostream>

int main() {
  int num;
  int * pNum;

  num = 5;
  pNum = &num;

  std::cout << "The value is: " << *pNum << "\n\n";

// split

  char v[5] = { 'A', 'B', 'C', 'D', 'E' };

  std::cout << "The first value of the array is: " << v[0] << "\n";
  std::cout << "The first value of the array is: " << *(v + 0) << "\n\n";

  std::cout << "The first value of the array is: " << v[1] << "\n";
  std::cout << "The first value of the array is: " << *(v + 1) << "\n\n";

  std::cout << "The first value of the array is: " << v[2] << "\n";
  std::cout << "The first value of the array is: " << *(v + 2) << "\n\n";

  std::cout << "The first value of the array is: " << v[3] << "\n";
  std::cout << "The first value of the array is: " << *(v + 3) << "\n\n";

  std::cout << "The first value of the array is: " << v[4] << "\n";
  std::cout << "The first value of the array is: " << *(v + 4) << "\n\n";
}