Here's the snippet
main(){
//
while(){
int b;
scanf("%d",&b);
int arr[b];
}
}
Ok now, Since I don't know the exact bound of array, I have to take in as a variable*using scanf*. And the array created contains garbage value. And for that purpose I have to initialize each element to 0, because that is what I want.
Is there a way I can get this thing to work, without having to initialize every time inside the loop?
Thanks
EDIT I guess I can use calloc to allocate the memory. Will there be a different in memory used?