Adobe Interview Question
Testing / Quality AssurancesCountry: United States
Interview Type: Phone Interview
Undefined, really. chptr is not initialized, but we assign a value to it, so the program may or may not crash. If it doesn't crash, it'll print "4 4" on a 32 bit machine.
In dev compiler, this program is crashing.
However on commenting the *chptr = *inptr line, I get 4 4 as the answer as the pointer variables are storing addresses, which are stored as int type.
No. Pointers record address. They have the same size, no matter what type of pointers they are. So, sizeof(char *) is also 4 byte.
Pointer stores the address of the data type, address is an integer so answer is 4 4 ( there was no option with 2 2).
Segmentation fault
- Chaitanya February 01, 2012*chptr=*intptr
no memory allocated to "chptr"