No, it's the same problem you met a few days ago:
int n,i,d;
int *c;
int a[n];
You do not specify a value for
n
before you create the array. And you've already seen that that creates an array with zero elements, even if you change
n
later.
So when you use them:
for(i=0;i<n;i++)
scanf("%d",&a[i]);
You overwrite other items in your stack.
Additionally, the name of an array is a pointer to the first element - that's part fop the C specification - so
d=sizeof(a);
is getting the size of a pointer - 4 for a 32 bits system, 8 for a 64 bit system. It does not, will not, anc cannot return the number of elements in the array, or the total size taken by the array in bytes.
There is no function in C to do that.
So this code:
x=(sizeof(a)/sizeof(a[0]));
Is pretty meaningless - it divides the size of a pointer by the size of an integer - which will probably be 1 or 2 depending on the size of your integers (probably 32 bit so sizeof will give you 4 for four bytes) and the size of a pointer in your system (which is probably 32 bits, so 4 for four bytes since you get "1" as a result of the division).