@@ -12,55 +12,55 @@ struct Person
1212 struct Person * next ;
1313};
1414
15- void printmenu ();
16- void getInput (struct Person * person );
17- void printPerson (struct Person * person );
15+ void PrintMenu ();
16+ void GetInput (struct Person * person );
17+ void PrintPerson (struct Person * person );
1818
1919/*
2020malloc failed -> -1 -> exit(1);
2121Success -> 0
2222*/
23- int addPerson (struct Person * * contacts );
23+ int AddPerson (struct Person * * contacts );
2424
2525/*
2626Not Found -> -1
2727Success -> 0
2828*/
29- int changePerson (struct Person * contacts );
29+ int ChangePerson (struct Person * contacts );
3030
3131/*
3232Not Found -> -1
3333Success -> 0
3434*/
35- int delPerson (struct Person * * contacts );
35+ int DeletePerson (struct Person * * contacts );
3636
3737/*
3838Not Found -> NULL
3939Success -> struct Person*
4040*/
41- struct Person * findPerson (struct Person * contacts );
41+ struct Person * FindPerson (struct Person * contacts );
4242
43- void displayContacts (struct Person * contacts );
43+ void DisplayContacts (struct Person * contacts );
4444
45- void releaseContacts (struct Person * * contacts );
45+ void ReleaseContacts (struct Person * * contacts );
4646
4747int main ()
4848{
4949 short code ;
5050 struct Person * contacts = NULL ;
51- printmenu ();
51+ PrintMenu ();
5252 while (1 )
5353 {
5454 printf ("Please input the command code:\n" );
5555 scanf ("%d" , & code );
5656 switch (code )
5757 {
5858 case 0 : {
59- printmenu ();
59+ PrintMenu ();
6060 break ;
6161 }
6262 case 1 : {
63- switch (addPerson (& contacts ))
63+ switch (AddPerson (& contacts ))
6464 {
6565 case -1 : {
6666 printf ("ERROR: malloc failed" );
@@ -75,10 +75,10 @@ int main()
7575 }
7676 case 2 : {
7777 printf ("Please input the name:\n" );
78- struct Person * person = findPerson (contacts );
78+ struct Person * person = FindPerson (contacts );
7979 if (person != NULL )
8080 {
81- printPerson (person );
81+ PrintPerson (person );
8282 }
8383 else
8484 {
@@ -88,7 +88,7 @@ int main()
8888 }
8989 case 3 : {
9090 printf ("Please input the name:\n" );
91- switch (changePerson (contacts ))
91+ switch (ChangePerson (contacts ))
9292 {
9393 case -1 : {
9494 printf ("The person is not found\n" );
@@ -103,7 +103,7 @@ int main()
103103 }
104104 case 4 : {
105105 printf ("Please input the name:\n" );
106- switch (delPerson (& contacts ))
106+ switch (DeletePerson (& contacts ))
107107 {
108108 case -1 : {
109109 printf ("The person is not found\n" );
@@ -116,7 +116,7 @@ int main()
116116 break ;
117117 }
118118 case 5 : {
119- displayContacts (contacts );
119+ DisplayContacts (contacts );
120120 break ;
121121 }
122122 case 6 : {
@@ -129,10 +129,10 @@ int main()
129129 }
130130 }
131131END :
132- releaseContacts (& contacts );
132+ ReleaseContacts (& contacts );
133133}
134134
135- void getInput (struct Person * person )
135+ void GetInput (struct Person * person )
136136{
137137 printf ("Please input name:\n" );
138138 scanf ("%s" , person -> name );
@@ -143,13 +143,13 @@ void getInput(struct Person *person)
143143 // Bounds Check Elimination is required
144144}
145145
146- void printPerson (struct Person * person )
146+ void PrintPerson (struct Person * person )
147147{
148148 printf ("Name:\n%s\n" , person -> name );
149149 printf ("Phone number:\n%s\n" , person -> phone );
150150}
151151
152- int addPerson (struct Person * * contacts )
152+ int AddPerson (struct Person * * contacts )
153153{
154154 struct Person * person = (struct Person * )malloc (sizeof (struct Person ));
155155
@@ -158,7 +158,7 @@ int addPerson(struct Person **contacts)
158158 return -1 ;
159159 }
160160
161- getInput (person );
161+ GetInput (person );
162162
163163 // linked-list is not empty
164164 if (* contacts != NULL )
@@ -174,7 +174,7 @@ int addPerson(struct Person **contacts)
174174 return 0 ;
175175}
176176
177- struct Person * findPerson (struct Person * contacts )
177+ struct Person * FindPerson (struct Person * contacts )
178178{
179179 char temp [40 ];
180180 // This should be move to function param
@@ -191,9 +191,9 @@ struct Person *findPerson(struct Person *contacts)
191191 return current ;
192192}
193193
194- int changePerson (struct Person * contacts )
194+ int ChangePerson (struct Person * contacts )
195195{
196- struct Person * current = findPerson (contacts );
196+ struct Person * current = FindPerson (contacts );
197197
198198 if (current != NULL )
199199 {
@@ -208,9 +208,9 @@ int changePerson(struct Person *contacts)
208208 }
209209}
210210
211- int delPerson (struct Person * * contacts )
211+ int DeletePerson (struct Person * * contacts )
212212{
213- struct Person * person = findPerson (* contacts );
213+ struct Person * person = FindPerson (* contacts );
214214
215215 if (person == NULL )
216216 {
@@ -239,16 +239,16 @@ int delPerson(struct Person **contacts)
239239 }
240240}
241241
242- void displayContacts (struct Person * contacts )
242+ void DisplayContacts (struct Person * contacts )
243243{
244244 while (contacts != NULL )
245245 {
246- printPerson (contacts );
246+ PrintPerson (contacts );
247247 contacts = contacts -> next ;
248248 }
249249}
250250
251- void releaseContacts (struct Person * * contacts )
251+ void ReleaseContacts (struct Person * * contacts )
252252{
253253 struct Person * temp = * contacts ;
254254
@@ -260,7 +260,7 @@ void releaseContacts(struct Person **contacts)
260260 }
261261}
262262
263- void printmenu ()
263+ void PrintMenu ()
264264{
265265 printf ("|Welcome to ContactsBook Manager Program|\n" );
266266 printf ("|0:print the Menu-----------------------|\n" );
0 commit comments