466 views
0 votes
0 votes

int *I ,j;

I =&j; 

why it is valid since j has not been defined so no memory will be allocated to j and I is having the address of J so it must saw segmentation fault

1 Answer

0 votes
0 votes
This is valid because in the first statement j is declared as an integer variable means the memory will be allocated to j, by default the allocated memory will contain the garbage value. In the second statement the address of j will be be saved in Pointer variable I.

No related questions found