개발자 톡

연습문제 톡 [한양대 HCPC 2023] X marks the Spot

C언어 런타임에러 해결 도움 요청

등록일
2024-03-22 15:48:57
조회수
229
작성자
daeun4719

#include <stdio.h>

#include <string.h>

void toUpperCase(char *str) {

  while (*str != '\0') {

    if (*str >= 'a' && *str <= 'z') {

      *str = *str - ('a' - 'A'); 

    }

    str++;

  }

}

int main(void)

{

  int n;

  char s1[500];

  char s2[500];

  char c1='X';

  char *pt1;

  scanf("%d",&n);

  

  for(int i=0;i<n;i++){

    scanf("%s",s1);

    scanf("%s",s2);

    toUpperCase(s1);

    toUpperCase(s2);

    pt1=strchr(s1,c1);

    printf("%c",s2[pt1-s1]);

  }

  return 0;

}


이렇게 작성했는데 런타임에러가 발생하네요. 어느 부분에서 수정이 필요할까요?

#[한양대_HCPC_2023]_X_marks_the_Spot

이 카테고리의 톡 더보기