I was writing a code to learn about arrays and I noticed that if an array is declared as
a[5];
It's storing garbage values as its' elements While
a[5] = {};
Is storing 0 as all the elements.
Can someone explain what is happening and how these values are being stored ?
I wondered if this was a static data type but it doesn't seem to be that
#include<stdio.h>
void increment();
int main()
{
increment();
increment();
increment();
}
void increment()
{
int a[5]={};
static int b[5]={1,2,3,4,5};
int i;
for(i=0;i<=4;i++)
{
a[i]++;
b[i]++;
}
printf("%d %d\n",a[1],b[1]);
}