Question

Question 12 (1 point) BONUS: (1 mark) What is wrong with the following line of code? char Msg[10]; scanf_st%s,Msg[0], 10);


Ull 3 13 points) Saved (3 marks) Create a structure for the following Xc parameters: capacitance, frequency, reactance strct

please answer both the ques

Question 4 (2 points) Iowser + (2 marks) Create a dynamic array of 200 of the above structures in Question 13

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

Question 1) What is wrong with the following Line of code?
char Msg[10];
scanf_s("%s",Msg[0],10);

Answer : Here the mistakes are as follows :
1) the syntax of scanf which you wrote is wrong
2) In the scanf you call variable along with its size which is wrong

The profer syntax should be sacnf ("%s", Msg);

Question 2) Create structure for the following Xc parameters: capacitance, frequency, reactance

Answer :

#include <stdio.h>
/* Created a structure here. The name of the structure is
* Xc.
*/
struct Xc{
float capacitance;
float frequency;
float reactance;
};
int main()
{
/* electric is the variable of structure Xc*/
struct Xc electric;

/*Assigning the values of each struct member here*/
electric.capacitance = 8.85;
electric.frequency = 43.0;
electric.reactance = 46.12;

/* Displaying the values of struct members */
printf("Capacitance value is: %d", electric.capacitance);
printf("Frequency value is: %d", electric.frequency);
printf("Reactance value is: %d", electric.reactance);
return 0;
}

Output :

Capacitance value is: 8.85
Frequency value is: 43.0
Reactance value is: 46.12

Add a comment
Know the answer?
Add Answer to:
please answer both the ques Question 12 (1 point) BONUS: (1 mark) What is wrong with...
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