Member Avatar for thendrluca

Hello World!
i wrote this code for fliping the array , but it doesn't work ...
why can anyone say me ? what i did wrong?
array and i,n variable are already global declared.

void exb(void)
{
    int aux;
    for(i=0;i<(n-1)/2;i++)
    {
        aux=x[i];
        x[i]=x[n-1-i];
        x[n-1-i]=aux;
    }
}

thanks :)

Describe your array, and which way you want to "flip" it - Rotate it 90° clockwise or counter-clockwise, or along a particular axis (specify which one). A 3 X 3 example of the array before and after the flip, would be great.

Use code tags around the example, or it will be mangled by the forum software.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.