C Programming and Technical

output?
main( )
{i
nt a[ ] = {10,20,30,40,50},j,*p;
for(j=0; j

Read Solution (Total 0)

C Other Question

output?

Q. main( )
{i
nt a[2][3][2] = {{{2,4},{7,8},{3,4}},{{2,2},{2,3},{3,4}}};
printf(%u %u %u %d n,a,*a,**a,***a);
printf(“%u %u %u %d n”,a+1,*a+1,**a+1,***a+1);
}
Answer:
100, 100, 100, 2
114, 104, 102, 3
Explanation: The given array is a 3-D one. It can also be viewed as a 1-D array.
100 102 104 106 108 110 112 114
116 118 120 122
thus, for the first printf statement a, *a, **a give address of first element. since the indirection
***a gives the value. Hence, the first line of the output.
for the second printf a+1 increases in the third dimension thus points to value at 114, *a+1
increments in second dimension thus points to 104, **a +1 increments the first dimension thus
points to 102 and ***a+1 first gets the value at first location and then increments it by 1. Hence,
the output.
output?
Q. What is dangling pointer in c?

A. If any pointer is pointing the memory address of any variable but after some variable has deleted from that memory location while pointer is still pointing such memory location. Such pointer is known as dangling pointer and this problem is known as dangling pointer problem.