in the following code if we declare a[1000000], l[1000000], r[1000000] arrays globally that is just above main then only it gives correct answer.
if we declare a[1000000], l[1000000], r[1000000] as local arrays that is inside int main function then it shows error and does not compute the answer.
does declaring array globally or locally is different??
please look into it. this is the code -