Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transport Operations

Authors: Allen Stuart

2nd Edition

978-0470115398, 0470115394

Students also viewed these Programming questions