Could somebody please help me with the correct answers of the following questions asked during an online test? I don't remember the exact code for every question hence am writing the questions in simple English. Syntax may seem incorrect because MS Word formats the text. Apologies for that.
*(p++) will increment the pointer, p[2] will then try to read outside of the array and you'll probably get an index out of bounds exception... are you sure you remembered the code right? Maybe it was (*p)++ which would increment the first value from 2 to 3, p[2] is still 6 though.
4: ... I don't know what the if will do there, but var == 38? 15:10 will return 10 when var is anything other than 38.
5: ... without knowing what the internals are... the first two can be swapped as a char* is an int and both return nothing, and the second two can be swapped, same reasons.
6 --p is reduce then use
p-- is use then reduce
so *(--p) would access the previous value.