Reputation: 1
I have problem in this sample code.
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i = 1, j = 2 ;
int **ipp = malloc(10);
int *ip1 = &i, *ip2= &j ;
ipp = &ip1;
// when I comment above line and uncomment this two lines
// get segmentation fault
// *ipp = ip1 ;
// **ipp = 3;
printf("ipp: %p %p %d \n",ipp,*ipp , **ipp);
printf("ip1: %p %d \n",ip1,*ip1 );
printf("ip2: %p %d \n",ip2,*ip2);
printf("i: %d \n",i);
printf("j: %d \n",j);
return 0 ;
}
I would really appreciate it if someone could guide me.
Upvotes: 0
Views: 75