Skip to content

Instantly share code, notes, and snippets.

@renatoargh
Created July 26, 2012 23:16
Show Gist options
  • Select an option

  • Save renatoargh/3185183 to your computer and use it in GitHub Desktop.

Select an option

Save renatoargh/3185183 to your computer and use it in GitHub Desktop.
void alterarValor(int x){
x = x + 2;
}
int main(){
int x = 4;
int *endereco_de_x = &x; //repare nesta linha
printf("x está armazenada em %p \n\n", endereco_de_x); //e nesta também
//x está armazenada em 0x7fff69032c24
printf("Valor inicial de x: %i \n", x);
alterarValor(x);
printf("Valor de x: %i >>> não foi alterado!!!", x);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment