Jump to content

Dúvida parva com listas e apontadores


so_simple
 Share

Recommended Posts

Guest id194
mudar_nodo(A,B);
   lista *TMP;

   TMP = A;
   A = B;
   B = TMP;
}

Não percebi lá muito bem o problema e apontadores não é o meu forte, mas será que isto não serve?

Link to comment
Share on other sites

Se queres criar as listas na função e devolvê-las, tens que passar à função apontadores para apontadores:

main(){
lista *A=NULL, *B=NULL;

mudar_nodo(&A, &B);

}

void mudar_nodo(lista **A, lista **B){
*A = (lista *)malloc...;
*B = (lista *)malloc...;
...
}

Desaparecido.

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
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.