27 lines
631 B
C
27 lines
631 B
C
#include "src.h"
|
|
#include <ctype.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
void c9(){
|
|
size_t lname_len = strlen(LAST_NAME);
|
|
char *lower_last = malloc(lname_len);
|
|
|
|
// Slightly faster way to memcpy for this purpose, might as well also copy
|
|
// in the lowercased variant of the source
|
|
const char *lname = LAST_NAME;
|
|
char *d = lower_last;
|
|
while (lname_len--)
|
|
*d++ = tolower(*lname++);
|
|
|
|
solve(9, "Converts string to lowercase",
|
|
fmtstr("Original String: %s\nLowercased String: %s", LAST_NAME,
|
|
lower_last));
|
|
}
|
|
|
|
int main() {
|
|
print_header();
|
|
c9();
|
|
return 0;
|
|
}
|