Question

which of the below correctly assigns the name laserJet400 to the "name" field? strcpy(officePrinter.name,"LaserJet400"); strcpy(officePrinter->name,"LaserJet400"); officePrinter.name,"LaserJet400";...

which of the below correctly assigns the name laserJet400 to the "name" field?
strcpy(officePrinter.name,"LaserJet400");
strcpy(officePrinter->name,"LaserJet400");
officePrinter.name,"LaserJet400";
officePrinter.name,"Laser400";
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer Option C

Reason: Option A is incorrect because strcpy is used to copy a value to a variable. But here we are assigning a value to the variable.

Option B is incorrect because strcpy is used to copy a pointer variable to another. So it is wrong.

Option C is correct because it is assigning officePrinter.name to the value LaserJet400

Option D is incorrect because will not assign the requested value.

If you liked the solution then give a thumbs up ?

Add a comment
Know the answer?
Add Answer to:
which of the below correctly assigns the name laserJet400 to the "name" field? strcpy(officePrinter.name,"LaserJet400"); strcpy(officePrinter->name,"LaserJet400"); officePrinter.name,"LaserJet400";...
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
ADVERTISEMENT