Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- typedef struct {
- char *first_name;
- char *last_name;
- } contact;
- void print_contact(contact *c) {
- printf("Name: %s %sn", c->first_name, c->last_name);
- }
- contact *populate_contact() {
- contact *c;
- char *input;
- c = (contact *)malloc(sizeof(contact));
- printf(">>> Please Input The First Name: ");
- fgets(input, 100, stdin);
- c->first_name = strdup(input);
- c->last_name = "Doe";
- }
- int main() {
- contact m = *populate_contact();
- print_contact(&m);
- return 0;
- }
Add Comment
Please, Sign In to add comment