23 lines
588 B
C
23 lines
588 B
C
|
#include "src.h"
|
||
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
#include <string.h>
|
||
|
|
||
|
void c6() {
|
||
|
size_t str_len = strlen(FIRST_NAME);
|
||
|
char *newstr = malloc(str_len + 1);
|
||
|
// strcpy is just calling memcpy under
|
||
|
// the hood
|
||
|
memcpy(newstr, FIRST_NAME, str_len + 1);
|
||
|
solve(6,
|
||
|
"Computes string's length and copies one string into another string",
|
||
|
fmtstr("String: %s, Location %p\nLength: %d\nCopied String: %s, Location: %p", FIRST_NAME, &FIRST_NAME,
|
||
|
str_len, newstr, &newstr));
|
||
|
}
|
||
|
|
||
|
int main() {
|
||
|
print_header();
|
||
|
c6();
|
||
|
return 0;
|
||
|
}
|