Skip to content

Tag Archives: C-Storage Classes and Type Qualifiers

Storage class of variables includes the scope, visibility and life-time which help to trace the existence of a particular variable during the runtime of a… Read More
In spite of tons of literature on C language, “volatile” keyword is somehow not understood well (even by experienced C programmers). We think that the… Read More
Storage Classes are used to describe the features of a variable/function. These features basically include the scope, visibility and life-time which help us to trace… Read More
Static variables have a property of preserving their value even after they are out of their scope!Hence, static variables preserve their previous value in their… Read More
#include <stdio.h> char *fun() {     static char arr[1024];     return arr; }    int main() {     char *str = "geeksforgeeks";     strcpy(fun(), str);     str = fun();     strcpy(str,… Read More
Output of following program #include <stdio.h> int fun(int n) {     static int s = 0;     s = s + n;     return (s); }    int… Read More
Output? #include <stdio.h>    int main(void) {     int i = 10;     const int *ptr = &i;     *ptr = 100;     printf("i = %d\n", i);     return 0;… Read More
#include <stdio.h> int main() {   extern int i;   printf("%d ", i);   {        int i = 10;        printf("%d ", i);   } } (A) 0 10 (B)… Read More
Output? #include <stdio.h> int main() {   register int i = 10;   int *ptr = &i;   printf("%d", *ptr);   return 0; } (A) Prints 10 on all… Read More
What output will be generated by the given code d\segment if: Line 1 is replaced by “auto int a = 1;” Line 2 is replaced… Read More
Output? (GATE CS 2012) #include <stdio.h> int a, b, c = 0; void prtFun (void); int main () {     static int a = 1; /*… Read More
In C, static storage class cannot be used with: (A) Global variable (B) Function parameter (C) Function name (D) Local variable Answer: (B) Explanation: Declaring… Read More
Consider the following C function int f(int n)  {     static int i = 1;     if (n >= 5)        return n;     n = n+i;     i++;     return… Read More
#include <stdio.h> int main()  {    int x = 10;    static int y = x;         if(x == y)       printf("Equal");    else if(x > y)       printf("Greater");    else… Read More
Output? #include <stdio.h> int fun() {   static int num = 16;   return num--; }    int main() {   for(fun(); fun(); fun())     printf("%d ", fun());   return… Read More