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

Unexpected response code representation #1

Open
thuanpv opened this issue Oct 27, 2020 · 3 comments
Open

Unexpected response code representation #1

thuanpv opened this issue Oct 27, 2020 · 3 comments

Comments

@thuanpv
Copy link
Collaborator

thuanpv commented Oct 27, 2020

Hi @alan32liu

Last week you asked the following question

/* TOASK:
* 1s. using id 410 works, but changing it to 010 will not print out 8 instead
* Similarly, 020 becomes 16
* How does it become octal?
*/

I have checked your implementation of the append_child function (its signature is: TreeNode * append_child(TreeNode * tree_node, int child_response_code, enum node_colour colour)). If you pass "010", C treats it as an octal number and hence its decimal value is 8. Similarly 020 -> 16, 030 -> 24 and so on. I think you just need to pass decimal numbers and it should be fine.

@thuanpv
Copy link
Collaborator Author

thuanpv commented Oct 27, 2020

Please see this to know more about octal numbers in C: https://www.includehelp.com/c/octal-literals.aspx

@DonggeLiu
Copy link
Owner

Thanks! I suppose this won't affect us then.

@thuanpv
Copy link
Collaborator Author

thuanpv commented Oct 28, 2020

Yes, it doesn't.

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

2 participants