what is the problem with this code- #include <stdio.h>
int main(void) { int a[20],i,n; scanf("%d",&n); for(i=0;i<n;i++) scanf("%d",&a[i]); for(i=0;a[i]!=42;i++) printf("%d\n",a[i]); return 0; }
What if n is 21? or one hundred, or a million?, or a bazillion? Ditch the array.