C/learnc/learnc10.c
2023-09-23 22:20:41 +03:00

23 lines
379 B
C
Executable File

#include <stdio.h>
typedef struct {
char * name;
int age;
} person;
/* function declaration */
void birthday(person * p) {
p->age++;
}
int main() {
person john;
john.name = "John";
john.age = 27;
printf("%s is %d years old.\n", john.name, john.age);
birthday(&john);
printf("Happy birthday! %s is now %d years old.\n", john.name, john.age);
return 0;
}