203k views
3 votes
In C, developers may access arrays via bracketed syntax like Java or by using * dereferencing notation. The following assignment statements use * notation. Provide the equivalent line of code using square bracket notation:

(a) (2 points) *racer = 22;
(b) (2 points) *(*(img) +1)) = 89;
(c) (2 points) *(*(img+15)+2)) = 64;
(d) (2 points) *(**(rgb_img+5)+1) = 320;

User Nassau
by
4.9k points

1 Answer

6 votes

Answer:

See explaination

Step-by-step explanation:

Square bracket notation is useful when working with objects.

When working with bracket notation, make sure the property identifiers is a String. They can include any characters, including spaces. Variables may also be used as long as the variable resolves to a String.

Below is a representation of the bracket for the question;

a)

racer[0] = 22;

b)

img[1][0] = 89;

c)

img[15][2] = 64;

d)

rgb_img[5][0][1] = 320;

User MISNole
by
5.5k points