- This topic is empty.
Viewing 1 post (of 1 total)
Viewing 1 post (of 1 total)
- You must be logged in to reply to this topic.
IT, Programming, & Web Development › Forums › CS50’s Introduction to Computer Science by Harvard University on Edx › Week 1: [C] – Data Types, Operators, Conditional Statements, Loops, and Command Line › Understanding infinite loop with while loop
Tagged: infinite loop, loop, loops
[dm_code_snippet background=”yes” background-mobile=”no” slim=”yes” line-numbers=”yes” bg-color=”#abb8c3″ theme=”dark” language=”clike” wrapped=”yes” height=”” copy-text=”Copy Code” copy-confirmed=”Copied”]
#include <stdio.h> #include <cs50.h> int main(void) { int h; h = get_int("h "); while (h > 2) { printf ("ffff"); } } [/dm_code_snippet] As any integer greater than 2 entered, there is an infinite loop (ffff printed infinitely). Could anyone please explain why so.
Reply
https://cs50.stackexchange.com/questions/41832/understanding-infinite-loop-with-while-loop[learn_press_profile]