Question: C Programming Question 4 (a) Consider the following C-program that fails to compile due to syntax errors. Identify the errors and correct the program so

C Programming

C Programming Question 4 (a) Consider the following C-program that fails to

Question 4 (a) Consider the following C-program that fails to compile due to syntax errors. Identify the errors and correct the program so that it compiles successfully. What will be the output when the program is executed successfully? #include #include void function 040: x, y = 5; 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. int main() { function (); function (): function (: return 0: 3 function 040 { int x = 1; static int y = 100;} printf("x = ", x); printf("y= ", y): x++; y++ 15. 16. 17. 18. 19. 20. 21. (b) Consider the C-program in Q4(a), Explain the purpose of the keyword static. (c) Consider the C-program in Q4(a), identify the global and local variables. What is the importance of global variables in a C-program? (d) Consider the following C fragment: if(a ==5) { printf("a is 5 "); } else if (a == 4) { printf("a is 4 "); } else { printf("a is unknown "); } Re-write this fragment using a switch statement

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!