Program Console Vignaankosh.com
Execution Panel
Console is empty.
Structure with string member is an interactive C dry run visualizer from the Structures 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.
#include <stdio.h>
#include <string.h>
struct Person {
char firstName[30];
char lastName[30];
char city[40];
char phone[15];
};
int main() {
struct Person p1 = {"Rahul", "Sharma", "Mumbai", "9876543210"};
struct Person p2;
// String assignment using strcpy
strcpy(p2.firstName, "Priya");
strcpy(p2.lastName, "Verma");
strcpy(p2.city, "Delhi");
strcpy(p2.phone, "9988776655");
printf("Person 1: %s %s, %s, Phone: %s\n",
p1.firstName, p1.lastName, p1.city, p1.phone);
printf("Person 2: %s %s, %s, Phone: %s\n",
p2.firstName, p2.lastName, p2.city, p2.phone);
// Modify string
strcpy(p1.city, "Pune");
printf("\nAfter relocation: %s now lives in %s\n", p1.firstName, p1.city);
return 0;
}