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

Exercise 6.06 #114

Open
elefrant1 opened this issue Mar 17, 2023 · 1 comment
Open

Exercise 6.06 #114

elefrant1 opened this issue Mar 17, 2023 · 1 comment

Comments

@elefrant1
Copy link

elefrant1 commented Mar 17, 2023

Hi,

Worked for me to compress it even more (but can't yet say if there are other drawbacks with this approach due to being new to C):

for (int i = 1; i <= 128; printf("%d ", i), i *= 2)
____ ;

Could move the ";" to same line as well with a comment for clarity

for (int i = 1; i <= 128; printf("%d ", i), i *= 2); // Empty body

@alvinng4
Copy link

alvinng4 commented May 14, 2024

This is not wrong but this is not a good practice since it is not easy to read. I prefer

for (int i = 1; i <= 128; i *= 2)
{
        printf("%d ", i);
}

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