Last active
March 14, 2019 10:32
-
-
Save kateolenya/316e04fd18aeab584514c00bd17ef6a3 to your computer and use it in GitHub Desktop.
Private variables in struct in 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 "private_var.h" | |
#include <stdio.h> | |
#include <stdlib.h> | |
struct Contact | |
{ | |
int mobile_number; | |
int home_number; | |
}; | |
struct Contact * create_contact() | |
{ | |
struct Contact * some_contact; | |
some_contact = malloc(sizeof(struct Contact)); | |
some_contact->mobile_number = 12345678; | |
some_contact->home_number = 87654321; | |
return( some_contact ); | |
} | |
void delete_contact( struct Contact * some_contact ) | |
{ | |
free(some_contact); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment