Q1. Difference betweenn local and global variables. BASIS FOR COMPARISON LOCAL VARIABLE GLOBAL VARIABLE Declaration Variables are declared inside a function. Variables are declared outside any function. Scope Within a function, inside which they are declared. Throughout the program. Access Accessed only by the statements, inside a function in which they are declared. Accessed by any statement in the entire program. Life Created when the function block is entered and destroyed upon exit. Remain in existence for the entire time your program is executing. Storage Local variables are stored on the stack, unless specified. Stored on a fixed location decided by a compiler. Q2. Wap a program to search INDIA from string LOVEINDIA and display it on screen. #include <string.h> #include <stdio.h> int main() { // Take any two strings char s1[] = "LOVEINDIA" ; c...
Comments
Post a Comment