From 92c5989691cde08ba67f237b73e8f871dacdf67d Mon Sep 17 00:00:00 2001 From: "Gustavo \"Guz\" L de Mello" Date: Mon, 30 Mar 2026 15:59:19 -0300 Subject: [PATCH] feat(strings): ex1 --- strings/ex1.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 strings/ex1.c diff --git a/strings/ex1.c b/strings/ex1.c new file mode 100644 index 0000000..3ae2799 --- /dev/null +++ b/strings/ex1.c @@ -0,0 +1,25 @@ +#include +#include +#include + +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; +}