Write all the C statements needed to define a new programmer-defined type that c
ID: 3801510 • Letter: W
Question
Write all the C statements needed to define a new programmer-defined type that contains a character string of up to 15 characters (including the ''), two integers, a float, and a pointer to another instance of that type. b. Now write the C statements needed to declare a variable of the type from part a, assign the value 100.0 to the float member of that variable and assign the string "John 44 rocks!" to the character string member of that variable. c. Now write the C statements needed to dynamically allocate an instance of the type you defined in part a, and then copy all the members of the variable declared in part b to that dynamically allocated instance.Explanation / Answer
b)
struct Programmer prog1;
strcpy( prog1.name, "John 44 rocks!");
prog1.index=100.1;
c) struct Programmer *prog2;
prog2 = &prog1;
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.