so I have spent some hours trying to figure out why my realloc doesnt enlarge my array of structs, but I seem to make no progress. Realloc either fails or doesnt enlarge the array. Is there any obvious mistake that Im making?
#include <getopt.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
typedef struct fileInfo {
    char accessRights[12];
    short hardLinks;
    short userName;
    short groupName;
    long size;
    char *time;
    char *fileName;
    short nrOfNode;
} fileInfo;
void enlargeFileInfos(fileInfo *fileInfoArray, int currentSize)
{
    fileInfo *temp = (fileInfo*)realloc(fileInfoArray, (currentSize + 1) * sizeof(fileInfo));
    if (!temp) {
        printf("realloc --FAILED--\n");
        return;
    }
    fileInfoArray = temp;
    printf("fileInfo grew to %d item(s)\n", currentSize + 1);
}
int main( )
{
    size_t nrOfDirs = 1;
    fileInfo *fileInfoArr = malloc(sizeof(fileInfo));
    for (int i = 0; i < 5; i++) {
        enlargeFileInfos(fileInfoArr, nrOfDirs);
        nrOfDirs++;
    }
    return 0;
}
 
    