Jump to content

ayuda con arreglo en c


gonzalo619

Recommended Posts

no se si esta bien lo hice sin probar, pero la idea del algoritmo se entiende:

int ancho=a;
int alto=b;
int aux = 1;
int indexing = -1;

(type) arreglo[ancho][alto];
(type) someNewVar[alto*ancho]

for(int i=0;i<ancho;i++){
    if(aux == 1){
        for(int j=0;j<alto;j++){
        indexing++;
        someNewVar[indexing] = arreglo[i][j];
        }
    aux++;
    }
    else{
        for(int j=alto-1;j>=0;j--){
        indexing++;
        someNewVar[indexing] = arreglo[i][j];
        }
    aux = 1;
    }
}

Saludos :adios:

Edited by cañangasñangas
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...