Community answers

Computer Programming

CT 401

Question
2080 BhadraChapter 9: Pointers9.2 Pointer Declaration

Compare call by value and call by reference with example. Write the output of the program shown below. Given memory addresses: a: 6422296, ptr1: 6422292, ptr2: 6422280 (a initially contains 10; pointer value boxes are blank in the printed diagram).

#include <stdio.h>
int main()
{
  int a=10,*ptr1,**ptr2;
  ptr1=&a;
  ptr2=&ptr1;
  printf("%d\t %d \n",a,&a);
  printf("%d\t %d \n",&ptr1,ptr1);
  printf("%d\t %d \n",*ptr1,*ptr2);
  **ptr2=20;
  printf("%d",a);
  return 0;
}

Add an answerChecking contribution access...

Community answers

0 answers

Search by subject name, course code, or acronym.