Implementation of append_char
void append_char(char **s, char c)
{
int n = 0;
if (*s) {
n = strlen(*s);
*s = realloc(*s, n + 2);
} else
*s = malloc(2);
(*s)[n] = c;
(*s)[n+1] = `\0';
}
Previous slide
Next slide
Back to first slide
View graphic version