Compare Strings (without strcmp) Dry Run in C

Compare Strings (without strcmp) 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.

Compare Strings (without strcmp) Program Code

#include <stdio.h>
int main() {
    char str1[] = "hello";
    char str2[] = "hello";
    int i = 0, equal = 1;
    
    while(str1[i] != '\0' || str2[i] != '\0') {
        if(str1[i] != str2[i]) {
            equal = 0;
            break;
        }
        i++;
    }
    
    if(equal && str1[i] == str2[i])
        printf("Strings are EQUAL\n");
    else
        printf("Strings are NOT equal\n");
    
    return 0;
}

View the complete Strings programs page.

Program Console Compare Strings (without strcmp) Topic: C Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.