Question: Based on the partial C code and the output of the execution as shown below, answer the following a) Write structure definition for struct Stock

 Based on the partial C code and the output of the

Based on the partial C code and the output of the execution as shown below, answer the following a) Write structure definition for struct Stock that consists of: grade (of type character) price (of type floating point) #include // Structure definition for struct Stock b) Provide function definition for update_Stock that accepts the following as function arguments: point (a pointer of type struct Stock) grade (character) price (floating point number) // Function definition for update_Stock // Function definition for display int main() { //Declare and initialize variables shell and esso based on Table 4.1 This function initializes data member where point is pointing to, based on the grade and price provided in the arguments. The function will not return anything. 1/Assign new values for variables shell and esso based on Table 4.2 and using function update_Stock c) Provide function definition for display that will take in a variable of type struct Stock as argument. This function will output content of all the data members of struct Stock (argument) on monitor. This function will not return anything. Tips: Refer to Figure 4.1 for precise output. printf ("For shell: "); display (shell); printf (" For esso: "); display (esso); d) Declare in main() two variables, namely shell and esso of type struck Stock and initialize it with the values given in Table 4.1. return 0; Name of variable shell esso Table 4.1 Grade C Price 28.10 18.50 D For shell: The grade is A The price is 128.50 For esso: The grade is B The price is 55.80 e) Initialize variables shell and esso based on the values given in Table 4.2 by calling function update_Stock ONLY. Tips: You need to call function update_Stock twice Table 4.2 Name of variable Grade Price shell 128.50 esso B 55.80 Figure 4.1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!