Scope of Variable 1 : Check Your C Skill

January 9, 2025 1 Comment » Hits : 168





#include<stdio.h>
int num = 50 ;
//---------------
void main()
{
int num = 20;
printf("%d",num);
}




Why Output is 20 ?
  1. Program contain 2 variables having same name.
  2. num = 50 is Global , num = 20 is local Variable 
  3. Note : In C Higher Priority is Given to Local Variables

Bookmark & Share

  • Anonymous

    best site