关于动态链表的问题,请问我这么写代码想实现一个存储字符类型的链表,哪里有问题?

源码如下:

#include<stdio.h>
#include<stdlib.h>

struct node
{
    char c;
    struct node* next;

};



int main(int argc,char argv[])
 
{
    int n;
    scanf_s("%d", &n);
    struct node* p_head, * p_tail, * p_new;
    p_head = (struct node*)malloc(sizeof(struct node));
    p_tail = p_head;
    int j;
    for (j = 0; j < n; j++)
    {
        p_new = (struct node*)malloc(sizeof(struct node));
        scanf_s("%c", &(p_new->c));
        p_tail->next = p_new;
        p_tail = p_new;
    }
    struct node* p = p_head->next;
    for (j = 0; j < n; j++)
    {
        printf("%c\n", p->c);
        p = p->next;
    }
    return 0;

 }

运行结果:

img

#include<stdio.h>
#include<stdlib.h>
struct node
{
    char c;
    struct node* next;
};
 
int main(int argc,char argv[])
{
    int n;
    scanf_s("%d", &n);
    getchar();
    struct node* p_head, * p_tail, * p_new;
    p_head = (struct node*)malloc(sizeof(struct node));
    p_tail = p_head;
    int j;
    for (j = 0; j < n; j++)
    {
        p_new = (struct node*)malloc(sizeof(struct node));
        scanf_s("%c", &(p_new->c),1);
        getchar();
        p_tail->next = p_new;
        p_tail = p_new;
    }
    struct node* p = p_head->next;
    for (j = 0; j < n; j++)
    {
        printf("%c\n", p->c);
        p = p->next;
    }
    return 0;
 }