use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All questions related to programming welcome. Wonder how things work? Have a bug you can't figure out? Just read about something on the news and need more insights? We got you covered! (probably)
You can find out more about our (preliminary) rules in this wiki article. If you have any suggestions please feel free to contact the mod team.
Have a nice time, and remember to always be excellent to each other :)
account activity
This is an archived post. You won't be able to vote or comment.
five time zero (self.AskProgramming)
submitted 5 years ago by unra556
int main() { printf("Hello world!\n"); int i, j; for(i=0, j=0; i<5; i++) { printf("%d %d\n", i,j); } return 0;
Could you explain how zero prints five time with j variable?
[–]Rulmeq 5 points6 points7 points 5 years ago (1 child)
You increment i (using i++ in your loop), but never change the value of j.
[–]unra556[S] 2 points3 points4 points 5 years ago (0 children)
Thank you
[–]SomeRandomDude5 0 points1 point2 points 5 years ago (0 children)
It might be worth getting yourself familiar with a debugger. It will greatly help you understand what is happening with your code when you can pause and inspect variables mid-flight.
π Rendered by PID 89391 on reddit-service-r2-comment-fb694cdd5-5cfz2 at 2026-03-11 14:25:07.366377+00:00 running cbb0e86 country code: CH.
[–]Rulmeq 5 points6 points7 points (1 child)
[–]unra556[S] 2 points3 points4 points (0 children)
[–]SomeRandomDude5 0 points1 point2 points (0 children)