Question
1. [20] Question on C programming, pointers: int b=5, a =7, c[10]; int *p; c[10] is initialized as all elements having a value of 23.
1. [20] Question on C programming, pointers:
int b=5, a =7, c[10];
int *p;
c[10] is initialized as all elements having a value of 23.
Write one or more C statement do the following:
a) Make p point to the location of a.
b) Assign b to have its current value plus the value pointed to by p.
c) Assign the value of what p is pointing to equal to 0.
d) Make p point to the second element of c array i.e., first element is c[0]
e) Now assign to b the contents of the third element of c array using p.
f) Add 5 to the contents for pointed to by p.
Next 4 questions, based on what has happened so far in steps a to f:
g) What is the value of *p?
h) What is the value to *(p + 7)?
i) What is the value of *p++?
j) Now what's the value of *p?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started