책은 do it c언어 입문

책에서 비주얼 스튜디오 2019 깔라길래 깔았고

구조체로 친구 정보 관리 프로그램 만들기임

오류 난 줄은 빨간색 볼드 숫자로 해놨음


아래는 코드


#include<stdio.h>

#define MAX_COUNT 5


typedef struct People

{

char name[14];

unsigned short int age;

float height;

float weight;

} Person;

int AddFriend (Person* p_friend, int count)

{

if (count < MAX_COUNT)

{

p_friend = p_friend + count;

printf("\n새로운 친구 정보를 입력하세요\n");

printf("이름:");

18 scanf_s("%s", p_friend->name);

printf("나이:");

scanf_s("%hu", &p_friend->age);

printf("키:");

scanf_s("%f", &p_friend->height);

printf("몸무게:");

scanf_s("%f", &p_friend->weight);

printf("입력 완료. \n\n");

return 1;

}

else

{

printf("최대인원 초과\n");

printf("최대 %d명까지만 관리 가능 \n\n", MAX_COUNT);

}

return 0;

}

void ShowFriendList(Person* p_friend, int count)

{

int i;

if (count > 0)

{

printf("\n등록된 친구 목록\n");

printf("==================================\n");

for (i = 0; i < count; i++)

{

printf("%-14s,%3d,%6.2f,%6.2f\n", p_friend->name, p_friend->age, p_friend->height, p_friend->weight);

p_friend++;

}

printf("==================================\n\n");

}

else

{

printf("\n등록된 친구가 없습니다\n\n");

}

}


void main()

{

Person friends[MAX_COUNT];

int count = 0, num;


while (1)

{

printf("    [메뉴]    \n");

printf("==============\n");

printf("1.친구 추가    \n");

printf("2.친구 목록 보기\n");

printf("3.종료\n");

printf("==============\n");

printf("번호선택:");

69 scanf_s("%d", num);

if (num == 1)

{

if (1 == AddFriend(friends, count)) count++;

}

else if (num == 2)

{

ShowFriendList(friends, count);

}

else if (num == 3)

{

break;

}

else

{

printf("번호가 유효하지 않습니다 (1,2,3번만 선택가능)\n\n");

}

}

}

이건 오류코드

뭐가 잘못된건지 모르게슴

써놓고보니까 존나 양심없이 물어봤네 재성합미다