Hi,

Can anyone explain to me why this code doesn't work well?

Code:
#include <stdio.h>
#include <stdlib.h>

void teste(int* n)
{
	n = (int*) malloc(sizeof(int));
	*n = 5;
}

int main()
{
	int* n = 0;

	teste(n);

	printf("Teste: %d", *n);

	return 0;
}
I would like to alloc memory inside a procedure passing the pointer I declared before in the main. Is there any way to make this thing work like I expect?