C
This commit is contained in:
23
learnc/learnc10.c
Executable file
23
learnc/learnc10.c
Executable file
@ -0,0 +1,23 @@
|
||||
#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;
|
||||
}
|
Reference in New Issue
Block a user