포인터의 메모리값에 문자열넣기가 원래 안되나요..?
말글
2023.04.01
#include stdio.h
int main(void)
{
char* peoinfo[3][4];
for(int b=0;b3;b++)
{
for(int c=1;c4;c++)
{
switch(c)
{
case 1:
printf(%d번째 사람의 이름 : ,b+1);
scanf(%s,*peoinfo[b][c]);
continue;
case 2:
printf(%d번째 사람의 전화번호 : ,b+1);
scanf(%s,*peoinfo[b][c]);
continue;
case 3:
printf(%d번째 사람의 주소 : ,b+1);
scanf(%s,*peoinfo[b][c]);
continue;
}
}
}
for(int b=0;b3;b++)
{
for(int c=1;c4;c++)
{
switch(c)
{
case 1:
printf(%d번째 사람의 이름 : %s,b+1,*peoinfo[b][c]);
continue;
case 2:
printf(%d번째 사람의 전화번호 : %s,b+1,*peoinfo[b][c]);
continue;
case 3:
printf(%d번째 사람의 주소 : %s,b+1,*peoinfo[b][c]);
continue;
}
}
}
}
전체 소스입니다. 구조체를 사용하지말라고 해서 이렇게햇는데..
이런경우가 한두번이 아니엿던걸로기억..
포인터의 메모리가 가리키는값이 쓰레기값이든 거기에 문자열넣으면 들어가는게 아닌가요..?