Jebus flippen Christ!
Can I post this one in the Code Horrors section? :jig: Can I, can I, can I?
That has got to be about the worst for-loop abuse I have ever seen in my life. That makes blood run from my eyes;p. It may come close to winning an obfuscation contest, but come tommorrow or the next day or next week and you'll be staring sideways at it like the rest of us.
I've just realized that it's actually an empty body for the for-loop. You've tried to do all of your processing and logic in the third parameter for the for loop.
You _can_ abuse it this far and get away with it:
int main()
{
int a[5]={5,1,4,2,3},i,j,n,flag=1,temp;
for(i=0,j=i ; (a[i]<a[j]); temp=a[i],a[i]=a[j],a[j]=temp);
return 0;
}
The reason it won't work is that you've tried to stuff if statements into the last part of the for loop - a big no-no, and one large enough that the compiler can't or wont allow you to do such as thing - I've no idea of the internals of TurboC or anything more modern, for that matter.
Following all of this fun and hilarity, I notice that you're trying to return void from main - that's also no good, and has been an enforced no-no for years now. If you get a new compiler, you'll get (a) better executable code for the same input (b) better error messages when it's not compilable (c) help to 'get things right' rather than a compiler that looks the other way.
I _think_ you're trying to write something like this?
int main()
{
int a[5]={5,1,4,2,3},i,j,n,flag=1,temp;
for(i=j=0; (a[i]<a[j]); )
{
temp=a[i];
a[i]=a[j];
a[j]=temp;
if(flag == 1)
{
i++;
}
if ((flag>1)&&(flag<6))
{
j++;
flag++;
}
else if (flag > 5)
{
flag=1;
}
}
}