what will be space complexity for snippet for(i=1 to n) int x=10;?
You are right. Are they saying if we run that loop n times then n different variables having name x will be created? This doesn't happen. Moreover, it is good practice to avoid unnecessary global variables. To check this yourself, you can try printing the logical address of x using this:-
for(i=0;i&lt;10;i++)
   {
       int x=1;
       printf(&quot;%d\n&quot;,&amp;x);
   }

The same logical address gets printed every time. So yes, the total space used by this is not dependent on n. It is O(1).
By the way, You could have thought that x gets destroyed only once at the end of last iteration and meanwhile all the values a[i] would be getting overwritten on the same x in each iteration. Even this is not what happens. x gets destroyed after each iteration and the space is made available for use by other parts.