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; +}