#define n 10
int a[n];
I wanted to declare an array globally and modify the size in other function
int main(){
int b;
printf("Enter the number of elements\n");
scanf("%d",&b);
#undef n
#define n b
for(int i = 0;i < n; i++)
scanf("%d",&a[i]);
display();
}
I modified the size in the main function
void display()
{
for(int i=0;i<n;i++)
printf("%d ",a[i]);
}
when i enter a size like 5 and enter the elements 1 2 3 4 5 the output shows 5 elements followed by 5 zeroes 1 2 3 4 5 0 0 0 0 0 how to remove the zeroes?