Member Avatar

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 :)

Re: How to flip horizontal an vector array in C ? 80 80

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 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.