Last active
August 29, 2015 14:05
-
-
Save evandertino/71dc0ea4a33a72f2d97d to your computer and use it in GitHub Desktop.
Back to C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void print(void); | |
unsigned long getId(void); | |
unsigned char getAge(void); | |
struct Student { | |
unsigned char Age; | |
unsigned long Student_ID; | |
void (*print)(); | |
unsigned long (*getId)(); | |
unsigned char (*getAge)(); | |
}evander={4, 30, &print, &getId, &getAge}; | |
void print(){ | |
printf("Age of evander=%d and ID of evander=%d",(unsigned int)evander.Age, (unsigned int)evander.Student_ID); | |
} | |
unsigned long getId() { | |
return evander.Student_ID; | |
} | |
unsigned char getAge() { | |
return evander.Age; | |
} | |
int main(int argc, char ** argv) { | |
evander.print(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment