C Program to Print the First Letter of Each Word - Source Code, Output & Execution Flow

C Program to Print the First Letter of Each Word

This tutorial explains c program to print the first letter of each word with C source code, sample output, and step-by-step execution flow.

#include <stdio.h>
int main() {
    char str[] = "C programming language";
    int i;
    printf("First letters: %c ", str[0]);
    for (i = 1; str[i]; i++) if (str[i - 1] == ' ' && str[i] != ' ') printf("%c ", str[i]);
    return 0;
}
First letters: C p l

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.

Sai Kishore Randhi, author
About the author

Sai Kishore Randhi

Embedded systems, VLSI, and chip design

Sai Kishore writes about embedded systems, VLSI, chip design, and the programming concepts behind modern hardware.

View LinkedIn profile ↗