Untitled

Run Settings
LanguageC
Language Version
Run Command
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> struct Person { char name[30]; int age; }; int main() { struct Person* p[5]; for (int i = 0; i < 5; i++) p[i] = malloc(sizeof(struct Person*)); int oldstage = 0; int oldstindex = 0; scanf("%s %d %s %d %s %d %s %d %s %d", &p[0]->name, &p[0]->age, &p[1]->name, &p[1]->age, &p[2]->name, &p[2]->age, &p[3]->name, &p[3]->age, &p[4]->name, &p[4]->age); for (int i = 0; i < 5; i++) { if (p[i]->age > oldstage) { oldstage = p[i]->age; oldstindex = i; } } printf("%s", p[oldstindex]->name); for (int i = 0; i < sizeof(p) / sizeof(struct Person*); i++) { free(p[i]); } return 0; }
Editor Settings
Theme
Key bindings
Full width
Lines