print ステートメントが null を返すのはなぜですか?
#include <stdio.h>>
#include <stdlib.h>
struct Node
{
char abbreviation;
double number;
struct Node *next;
};
void insert(char abbreviation, double number, struct Node *head) {
struct Node *current = head;
while(current->next != NULL)
{
current = current->next;
}
struct Node *ptr = (struct Node*)malloc(sizeof(struct Node));
ptr->abbreviation = abbreviation;
ptr->number = number;
current->next = ptr;
return;
}
int main(int argc, char* argv[]) {
struct Node *head = (struct Node*)malloc(sizeof(struct Node));
insert('n',456,head);
printf("%s\n", head->abbreviation);
}