"일꾼이 일을 잘하려면 먼저 도구를 갈고 닦아야 한다." - 공자, 『논어』.
첫 장 > 프로그램 작성 > 문자열에서 문자를 제거하려면 짜내십시오.

문자열에서 문자를 제거하려면 짜내십시오.

2024-08-01에 게시됨
검색:455

squeeze to remove chars from string.

https://www.learntosolveit.com/은 최신 도구를 사용하여 K&R 책을 사용하여 C 프로그래밍을 배울 수 있는 동반 웹사이트입니다. 이 게시물에서는 책에 있는 연습문제와 주제에 대해 설명합니다.

/**
 * Exercise 2.4
 *
 * Let us write a version of squeeze(s1,s2) that deletes each
 * character in the string 1 that matches any character in the string s2.
 * Utilize user defined function mgetline to input the strings.
 * Don't use any standard library string manipulation function.
 *
 **/

#include 

#define MAXLINE 1000

int mgetline(char s[], int lim);

void squeeze(char s1[], const char s2[]);

int main(void) {
    char s1[MAXLINE], s2[MAXLINE];
    mgetline(s1, MAXLINE);
    mgetline(s2, MAXLINE);

    squeeze(s1, s2);

    printf("\n%s\n", s1);

    return 0;
}

int mgetline(char s[], int lim) {
    int i, c;

    for (i = 0; i 



이 게시물에서 이 프로그램에 대한 시각적 설명을 따르세요 - https://www.learntosolveit.com/cprogramming/chapter2/ex_2.4_squeezess

릴리스 선언문 이 기사는 https://dev.to/orsenthil/squeeze-to-remove-chars-from-string-4n01에서 복제됩니다. 침해 내용이 있는 경우, [email protected]으로 연락하여 삭제하시기 바랍니다.
최신 튜토리얼 더>

부인 성명: 제공된 모든 리소스는 부분적으로 인터넷에서 가져온 것입니다. 귀하의 저작권이나 기타 권리 및 이익이 침해된 경우 자세한 이유를 설명하고 저작권 또는 권리 및 이익에 대한 증거를 제공한 후 이메일([email protected])로 보내주십시오. 최대한 빨리 처리해 드리겠습니다.

Copyright© 2022 湘ICP备2022001581号-3