2022-05-31 07:29:27 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
int main(){
|
|
|
|
char one[] = "Whatever!";
|
|
|
|
char *two;
|
|
|
|
FILE *fp = fopen("lc.out", "w");
|
|
|
|
|
|
|
|
fprintf(fp, "Printf: %d\n", 10);
|
|
|
|
fprintf(fp, "Whatever: %s, length %d\n", one, strlen(one));
|
|
|
|
|
|
|
|
two = malloc(sizeof(char) * 20);
|
|
|
|
memcpy(two, one, 3);
|
|
|
|
two[3] = '\0';
|
|
|
|
fprintf(fp, "Two: %s, length %d\n", two, strlen(two));
|
|
|
|
|
2024-01-31 10:14:41 +00:00
|
|
|
fclose(fp);
|
2022-05-31 07:29:27 +00:00
|
|
|
free(two);
|
|
|
|
return 0;
|
|
|
|
}
|