i am declaring a global array,and then assigning the values inside a if statement. But when i am using the array in another if statement the array has different values other than i assigned previously. For example:
int arr[5];
xyz(bool p,bool q)
{
if(p)
{
for(int i=0;i<5;i++)
{
arr[i]=rand()%100;
}
}
if(q)
{
for(i=0;i<5;i++)
printf("%d",arr[i]);
}
}
can anyone help??