You missed the point. Your function is expected to return an integer
int init_socket(int *sockfd);
But the logic in the body of the function doesn't return anything when socket creation is successful.
If you had this situation below where the socket creation was successful
int ans = init_socket(&sock);
What would the value of ans be?