feat(strings): ex1
This commit is contained in:
25
strings/ex1.c
Normal file
25
strings/ex1.c
Normal file
@@ -0,0 +1,25 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(void) {
|
||||
char str1[100], str2[100];
|
||||
|
||||
printf("Digite a primeira frase: ");
|
||||
fgets(str1, 100, stdin);
|
||||
|
||||
str1[strcspn(str1, "\n")] = '\0';
|
||||
|
||||
printf("Digite a segunda frase: ");
|
||||
fgets(str2, 100, stdin);
|
||||
|
||||
str2[strcspn(str2, "\n")] = '\0';
|
||||
|
||||
char strRes[200];
|
||||
strcpy(strRes, str1);
|
||||
strcat(strRes, str2);
|
||||
|
||||
printf("%s", strRes);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Reference in New Issue
Block a user