Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
master-embedded-systems
c-exercise-solutions public
Commits
0e78210c
Commit
0e78210c
authored
Dec 14, 2017
by
Dominik Widhalm
Browse files
Minor bugfix in example solution task 6.15
parent
26364134
Changes
1
Hide whitespace changes
Inline
Side-by-side
ch_6/task_15/main.c
View file @
0e78210c
...
...
@@ -89,10 +89,14 @@ person_t *person_new (addtype_t type, person_t *child) {
printf
(
"Please enter %s's first name: "
,
query
);
/* Read in the user's input */
fgets
(
new
->
firstname
,
STRING_MAX
,
stdin
);
/* Remove newline from string */
new
->
firstname
[
strlen
(
new
->
firstname
)
-
1
]
=
'\0'
;
/* Ask the user to enter the person's family name */
printf
(
"Please enter %s's family name: "
,
query
);
/* Read in the user's input */
fgets
(
new
->
familyname
,
STRING_MAX
,
stdin
);
/* Remove newline from string */
new
->
familyname
[
strlen
(
new
->
familyname
)
-
1
]
=
'\0'
;
/* Initially set its Kekule number to 0 */
new
->
kekule
=
0
;
/* Initially set its parent pointers to NULL */
...
...
@@ -335,7 +339,7 @@ int main (void) {
/* Ask the user if he/she wants to add a new level of parents */
printf
(
"Do you want to add a new level (y/n): "
);
/* Read in the user's response */
scanf
(
" %c"
,
&
input
);
scanf
(
" %c
%*c
"
,
&
input
);
/* Check if user wants to add a new level */
if
(
input
==
'y'
)
{
/* (Try to) add a new level of ancestors */
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment