feat(strings): ex1

This commit is contained in:
Guz
2026-03-30 15:59:19 -03:00
parent 3121e6533e
commit 92c5989691

25
strings/ex1.c Normal file
View 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;
}