Question: #include int main() { int i, z[10] = {1, 2, 3, 4, 5, 5, 4, 3, 2, 1}; int *pz, end_z; pz = &z; //
#include
int main()
{
int i, z[10] = {1, 2, 3, 4, 5, 5, 4, 3, 2, 1};
int *pz, end_z;
pz = &z; // pz pointer gets the address of z[0] example 8AD2
end_z = pz+10;
/* Printing all elements of z by pointing to z through pz */
//for(i = 0 ; i<10 ; i++) { printf( %d, z[i] );}
for( ; pz < end_z; pz++)
{
printf(" The next element of z is: %d", *pz); //prints i and the current target of pz
// pz increments; hence points to the next neighbor address
}
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
