Check if String is Palindrome Dry Run in C

Check if String is Palindrome is an interactive C dry run visualizer from the Strings programs section. Study the source code, then use the execution controls to follow each step, variable update, highlighted line, and console output.

This page provides a browser-based dry run with source-code highlighting, auto-scroll, voice narration controls, and execution output for learning the program step by step.

Check if String is Palindrome Program Code

#include <stdio.h>
int main() {
    char str[] = "madam";
    int length = 0, i, isPalindrome = 1;
    
    while(str[length] != '\0') {
        length++;
    }
    
    for(i = 0; i < length/2; i++) {
        if(str[i] != str[length-1-i]) {
            isPalindrome = 0;
            break;
        }
    }
    
    if(isPalindrome)
        printf("'%s' is a PALINDROME\n", str);
    else
        printf("'%s' is NOT a palindrome\n", str);
    
    return 0;
}

View the complete Strings programs page.

Program Console Check if String is Palindrome Topic: C Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.