C | Storage Classes and Type Qualifiers | Question 19
str = fun();
(C) geeksforgeeks geeksquiz
(D) Compiler Error
Explanation: Note that arr is static in fun() so no problems of returning address, arr will stay there even after the fun() returns and all calls to fun() share the same arr.
strcpy(fun(), str); // Copies "geeksforgeeks" to arr
str = fun(); // Assigns address of arr to str
strcpy(str, "geeksquiz"); // copies geeksquiz to str which is address of arr
printf("%s", fun()); // prints "geeksquiz"
Quiz of this Question
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses
are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!