C19
This commit is contained in:
27
C19/ex3.c
Normal file
27
C19/ex3.c
Normal file
@@ -0,0 +1,27 @@
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
struct Person {
|
||||
int age;
|
||||
int year_of_birth;
|
||||
char forename[30];
|
||||
char surname[50];
|
||||
};
|
||||
|
||||
|
||||
void print_person(struct Person p) {
|
||||
printf("p.age=%d p.year_of_birth=%d p.forename=%s p.surname=%s\n", p.age, p.year_of_birth, p.forename, p.surname);
|
||||
}
|
||||
|
||||
|
||||
int main() {
|
||||
struct Person p;
|
||||
|
||||
printf("Enter age: "); scanf("%d", &p.age);
|
||||
printf("Enter birth year: "); scanf("%d", &p.year_of_birth);
|
||||
printf("Enter forename: "); scanf("%29s", p.forename);
|
||||
printf("Enter surname: "); scanf("%49s", p.surname);
|
||||
|
||||
print_person(p);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user