Does anyone know why this program crashes at "printf", I have no idea to be honest, thanks in advance. enter image description here
Added from comments:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct{
char *content;
}DATABASE;
DATABASE *database;
void example(DATABASE *db){
db = malloc(sizeof(DATABASE));
db[0].content = calloc(6,1);
memcpy(db[0].content,"hello",6);
}
void main(){
example(database); //it crashes here!!!
printf("%s\n",database[0].content);
}