구조체 배열 scanf 질문...
행복녀
2023.04.01
질문 제목 :구조체 배열scanf 질문...
질문 요약 :구조체 배열에 scanf 로 값을 입력받을때 왜 &를 안쓰나요?질문 내용 :
struct person{
char name[20];
char phone[20];
}
이 있다고 할때
struct person pArray[3];
for(i=0; i3; i++)
{
scanf(%s %s, pArray[i].name, pArray[i].phone);
printf(이름 %s 전화번호 %s , pArray[i].name, pArray[i].phone);
}
왜 위와같이 scanf, printf 모두 pArray[i].name, pArray[i].phone 이라고 쓸까요?
왜 scanf 로 입력받을때 &를 안쓰는 건가요?
-
두온
껍데기(person) 안에 있는 내용물(char [])을 보세요.
name, phone 모두 char형 배열의 이름이고, 주소값을 가집니다.