I don't understand why this first version of my code is working and the second isn't.
First version :
#include <stdio.h>
#include <stdlib.h>
void procedure(int *t){
    t = (int*)realloc(t, 4*sizeof(int));
    t[3] = 4;
}
int main()
{
    int *var;
    var = (int*)malloc(sizeof(int));
    procedure(var);
    printf("%d\n\n", var[3]);
}
Second version:
#include <stdio.h>
#include <stdlib.h>
void procedure(int *t){
    t = (int*)malloc(4*sizeof(int));
    t[3] = 4;
}
int main()
{
    int *var = NULL;
    procedure(var);
    printf("%d\n\n", var[3]);
}
In the second version, var is still a NULL pointer after the procedure execution. Why?
 
     
     
    