%s를 이용한 문자열 출력 질문
해대기
2023.04.01
질문 제목 : %s를 이용한 문자열 출력 질문글자가 깨져요!질문 내용 :
void printmatrix(char *x,mtype *mat, int row, int col) //지정한 행렬을 출력
{
int i;
x = (char*) malloc (sizeof(char)*20);
printf(%s(을)를 출력합니다.\n,x);
for(i=0;i(row*col);i++)
if(i==(row-1)){
printf(%lf ,mat[i]);
printf(\n);
}else{
printf(%lf ,mat[i]);
}
}
void main void()
{
printmatrix(역행렬,imat, m, n);
}
실행하면 빨간글씨 부분의 실행결과로글자가 깨져서 나오는데 왜이러죠? 이러는 이유와 방법좀 알려주세요