카타 8급 Is this my tail?

C[ | ]

#include <string.h>
int correct_tail(const char *body, const char *tail) {
  return body[strlen(body)-1] == *tail;
}
#include <string.h>
int correct_tail(const char *body, const char *tail) {
  return !strcmp(body + strlen(body) - strlen(tail), tail);
}
#include <string.h>
int correct_tail(const char *body, const char *tail) {
  int len = strlen(tail);
  int diff = strlen(body)-len;
  if( diff<0 ) return 0;
  for(int i=0; i<len; i++) {
    if(body[diff+i] != tail[i]) return 0;
  }
  return 1;
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}