1

I went through the tentative definition from one of the stackoverflow articles, so I ran the following program, it went fine according to the definition:

#include <stdio.h>
int a;
int a=5;
int main()
{
    printf("%d\n",a);
}

I also tried this concept for local variables through following C program:

#include <stdio.h>
int main()
{
    int a;
    int a=5;
    printf("%d\n",a);
}

This gave error: redeclaration of symbol a.

Please help me in understanding this.

Paul Ogilvie
  • 25,048
  • 4
  • 23
  • 41
Rishab Shinghal
  • 591
  • 3
  • 16

0 Answers0