Home /
Expert Answers /
Computer Science /
11-what-are-the-scope-rules-in-c-and-how-do-they-affect-variable-visibility-12-explain-the-use-o-pa223
(Solved): 11. What are the scope rules in C and how do they affect variable visibility? 12. Explain the use o ...
11. What are the scope rules in C and how do they affect variable visibility? 12. Explain the use of break and continue statements in C loops. 13. What are static variables in C, and what are their unique properties? 14. Explain the concept of pointers in C and how to declare a pointer variable. 15. How do you dynamically allocate memory in C using malloc(), and how do you free the memory using free()?
11. There are many scope roles in C that are Block scope, File scope, Function Prototype Scope and Function scope.They affect variable visibility in different ways as it is different for all types of scope roles.Block scope has visibility inside its block only.Identifiers of file scope are visible throughout where file is global.Function Prototype Scope has scope in the prototype itself.Function Scope has scope within the given function. 12Break is used to terminate the loop completely whereas continue statement skip a code of line then again execute the loops.while(i < 5) {if(i==4)break;}So, here when the i value hits 4, the loop is terminated.while(i < 5) {if(i==4)continue;}so, here when the i value hits 4, the statement in skipped and loop again work as normal.Here, problems are answered.