글의 코드에 대해 질문!!

조회수 475회
#include <stdio.h>
#include <stdlib.h>
#define MALLOC(p,s) \
if (!((p) = malloc(s))) { \
    fprintf(stderr, "Insufficient memory"); \
    exit(1); \
}
typedef struct Node {
    int data;
    struct listNode *link;
}listNode;
void printList(listNode *first) {
    printf("The list contains: ");
    for (; first; first = first->link)
        printf("%4d", first->data);
    printf("\n");
}
listNode create2() {
    listNode *first, *second;
    MALLOC(first, sizeof(*first));
    MALLOC(second, sizeof(*second));
    second->link = NULL;
    scanf_s("%d", &first->data);
    scanf_s("%d", &second->data);
    first->link = second;
    return *first;
}
void main() {
    listNode a;
    a=create2();
    printList(&a);
}
  1. return *first; 를 써도 괜찮나요?
  2. typedef struct Node { int data; struct listNode *link; }listNode; 여기서 Node와 listNode는 뭔차이죠?
  • (•́ ✖ •̀)
    알 수 없는 사용자

답변을 하려면 로그인이 필요합니다.

프로그래머스 커뮤니티는 개발자들을 위한 Q&A 서비스입니다. 로그인해야 답변을 작성하실 수 있습니다.

(ಠ_ಠ)
(ಠ‿ಠ)