26 lines
431 B
C
26 lines
431 B
C
#include <stdio.h>
|
|
|
|
|
|
struct Person {
|
|
int age;
|
|
char forename[30];
|
|
char surname[50];
|
|
};
|
|
|
|
|
|
void print_person(struct Person p) {
|
|
printf("p.age=%d p.forename=%s p.surname=%s\n", p.age, p.forename, p.surname);
|
|
}
|
|
|
|
|
|
int main() {
|
|
struct Person p;
|
|
|
|
printf("Enter age: "); scanf("%d", &p.age);
|
|
printf("Enter forename: "); scanf("%29s", p.forename);
|
|
printf("Enter surname: "); scanf("%49s", p.surname);
|
|
|
|
print_person(p);
|
|
return 0;
|
|
}
|