Question

Complete each of the following C statements by adding an asterisk, ampersand, or subscript wherever needed to make the statemPlease help folks, I really appreciate!

0 0
Add a comment Improve this question Transcribed image text
Answer #1

(a)

agep=age;

No need to change anything because age it self a pointer to the first variable of the array.

here are we are copying that address to the agep. When we try to print it prints the first value.

printf("%d",*agep);//30

(b)

s= *agep;

agep is pointer to the first element of the array. So access that value place asterisk before agep.

Now s have the value 30.

(C)

agep= &age[1];

we konw that agep is a pointer . 65 is at index 1.

So &age[1] will be the address of the value 65.

(d)

maxp=agep;

Both agep and maxp are pointers. So no need to change anything in the statement .

The address in the agep is now also in maxp. Which means maxp also referent to same value as agep.

(e)

agep is pointer and it only stores the address of a variable. It cannot store the value of expression directly. So first we store value in the variable and then pass address of that variable to the pointer.

t=(age[1]+age[3])/2;

agep=&t;

(f)

scanf("%hi",&age[2]);

stores value at address of third element in the array.

(g)

You cannot take user input into the pointer . It gives segmentation fault. First we have pass the address of the variable to it and take input.

aegp=&t;

scanf("%hi",agep);

(h)

printf("%hi",*agep);

use asterisk to print the value in the pointer

Add a comment
Know the answer?
Add Answer to:
Please help folks, I really appreciate! Complete each of the following C statements by adding an...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I need a basic program in C to modify my program with the following instructions: Create...

    I need a basic program in C to modify my program with the following instructions: Create a program in C that will: Add an option 4 to your menu for "Play Bingo" -read in a bingo call (e,g, B6, I17, G57, G65) -checks to see if the bingo call read in is valid (i.e., G65 is not valid) -marks all the boards that have the bingo call -checks to see if there is a winner, for our purposes winning means...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT