Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chapter08/ex4.c #5

Open
Richard3134 opened this issue Apr 26, 2024 · 0 comments
Open

chapter08/ex4.c #5

Richard3134 opened this issue Apr 26, 2024 · 0 comments

Comments

@Richard3134
Copy link

Line 25 structure definition is incorrect, size of the tab of char should be day[10] and not day[9].

Try to enter the date 01 05 2024, the answer will be wednesdaythursday instead of wednesday.

That's because the '\0' is missing due to the wrong size definition, therefore the printf function looks for the '\0' of thursday which is next to wednesday in memory.

24 struct WeekDays {
25 char day[9];
26 };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant