C Program to Add or Concatenate Two Strings - Source Code, Output & Execution Flow

C Program to Add or Concatenate Two Strings

This tutorial explains c program to add or concatenate two strings with C source code, sample output, and step-by-step execution flow.

#include <stdio.h>
#include <string.h>
int main() {
    char s1[50] = "Hello ";
    char s2[] = "World";
    strcat(s1, s2);
    printf("Concatenated string: %s
", s1);
    return 0;
}
Concatenated string: Hello World

In this program, the input is read first when required, the core logic is applied step by step, and the final result is displayed using printf(). Follow the execution flow beside the code to understand how each statement contributes to the output.