练习5-3
#include <stdio.h>
#include "chapter_5.h"
void Strcat(char *s, char *t) {//5-3
while (*s != '\0' && *t !='\0') {
++s;
}
while (*t != '\0') {
*(s++) = *t;
++t;
}
}
练习5-4
#include <stdio.h>
#include "chapter_5.h"
int Strend(char *s, char r) {//5-4
while (*s != '\0') ++s;
if (*(--s) == r)
return 1;
else
return 0;
}
练习5-5
#include <stdio.h>
#include <stdbool.h>
#include "chapter_5.h"
void Strncpy(char *s, char *t, int n) {//5-5
int count = 0;
while (*t != '\0' && count < n) {
*s = *t;
++s;
++t;
count++;
}
}