Skip to content

Tag Archives: C-Variable Declaration and Scope

A variable is a name given to a memory location. It is the basic unit of storage in a program. The value stored in a… Read More
Instance Variable: It is basically a class variable without a static modifier and is usually shared by all class instances. Across different objects, these variables… Read More
In this article, we will discuss the ways to compare a variable with values. Method 1: The idea is to compare each variable individually to… Read More
Perquisites: Identifiers, Variables Identifiers Identifiers are used for the naming of variables, functions, and arrays. It is a string of alphanumeric characters that begins with… Read More
static variables Static variables have a property of preserving their value even after they are out of their scope! Hence, static variables preserve their previous… Read More
In a small code, we can track values of global variables. But if the code size grows, they make code less understandable (hence less maintainable).… Read More
In C programming language, the variables should be declared before a value is assigned to it. For Example: // declaration of variable a and //… Read More
It is often quite hard to distinguish between scope and linkage, and the roles they play. This article focuses on scope and linkage, and how… Read More
Consider the below two programs: // Program 1 int main() {    int x;    int x = 5;    printf("%d", x);    return 0;  } Output in C:… Read More
A variable in C is a memory location associated with some name in order to store some form of data and retrieve it when required.… Read More
Consider the following C program, which variable has the longest scope? int a; int main() {    int b;    // ..    // .. } int c;… Read More
int main() {   int x = 032;   printf("%d", x);   return 0; } (A) 32 (B) 0 (C) 26 (D) 50 Answer: (C) Explanation: When a… Read More
Output? #include <stdio.h> int main() {   int x = 1, y = 2, z = 3;   printf(" x = %d, y = %d, z =… Read More
Output? int main() {   {       int var = 10;   }   {       printf("%d", var);     }   return 0; } (A) 10 (B) Compiler Error (C) Garbage Value… Read More
#include <stdio.h> extern int var = 0; int main() {     var = 10;     printf("%d ", var);     return 0; } (A) 10 (B) Compiler Error: var… Read More

Start Your Coding Journey Now!