previous | start | next

7. Pointer Example 1

What is printed?

int main()
{
  int *p, *q;
  int x = 5;
  int y = 10;
  int n = 0;

  p = &x;
  q = &y;

  n = n + *p;
  p = q;
  n = n + *p;

  cout << n << endl;
  return 0;
}

Output: 



previous | start | next