How to Concatenate Strings in C Without strcat()

💻 Day 7 of My 30-Day Embedded C Programming Challenge 🧩 Question of the Day: Write a program to concatenate two strings — a common interview question in C programming. 💡 Concepts Covered: Manual string manipulation in C Array indexing and memory handling Understanding null termination in strings Handling alphabetic and numeric inputs ⚙️ Approach I Used: Took two strings as input from the user. Used a loop to find the end of the first string. Appended the second string character by character to the first string. Ensured the final string was properly null-terminated. Did not use any standard library functions like strcat() or strlen(). 📘 Key Learning: This exercise reinforced my understanding of how strings are stored in memory, how concatenation works internally, and how to perform manual string operations safely using array indexing. ✅ Output Example: Enter first string: Hello Enter second string: World Concatenated string: HelloWorld #30DayCodingChallenge #EmbeddedC #CProgramming #StringManipulation #MemoryManagement #CodeEveryday #InterviewPrep #LearningJourney

  • text

1 - str1 is 100 dont use just alone %s, use %100s (or 99, the 100th will be the null termination) 2 - dont use while and do while when you are processing strings, some day you will mess the things up

Like
Reply

To view or add a comment, sign in

Explore content categories