C
This commit is contained in:
18
learnc/learnc3.c
Executable file
18
learnc/learnc3.c
Executable file
@ -0,0 +1,18 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
int main() {
|
||||
char first_name[5] = "John";
|
||||
char last_name[4] = "Boe";
|
||||
char name[100];
|
||||
|
||||
last_name[0] = 'B';
|
||||
sprintf(name, "%s %s", first_name, last_name);
|
||||
if (strncmp(name, "John Boe", 100) == 0) {
|
||||
printf("Done!\n");
|
||||
}
|
||||
name[0]='\0';
|
||||
strncat(name,first_name,4);
|
||||
strncat(name,last_name,20);
|
||||
printf("%s\n",name);
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user