Question

Must be done in C. given the following struct and function, modify the function to take...

Must be done in C.

given the following struct and function, modify the function to take a pointer to a student struct. Make the necessary modifications to the code in the function arguments and body.

struct student
{
char name [30];
char housing [30];
int count;
};

void getName(char*name,int n)
{
printf("Enter name:");
fgets(name,n,stdin);

0 0
Add a comment Improve this question Transcribed image text
Answer #1
struct student {
    char name[30];
    char housing[30];
    int count;
};

void getName(struct student *s) {
    printf("Enter name:");
    fgets(s->name, s->count, stdin);
}
Add a comment
Know the answer?
Add Answer to:
Must be done in C. given the following struct and function, modify the function to take...
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
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