Readability lab: Help counting no. of lines in text › Forums › CS50’s Introduction to Computer Science by Harvard University on Edx › Week 2: [Arrays] – Functions, Variable and Scope, Debugging, Arrays, and Command Line Arguments › Readability lab: Help counting no. of lines in text Tagged: counter, infinite loop This topic has 0 replies, 1 voice, and was last updated December 23, 2021 at 9:05 am by admin. Viewing 1 post (of 1 total) Author Posts December 23, 2021 at 9:05 am #122 adminKeymaster [dm_code_snippet background=”yes” background-mobile=”yes” 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> #include <string.h> int main(void) { string enterword = get_string("input"); int t = strlen(enterword); printf("%i\n", t); for(int i = 0; i<= t; i++) { int counter = 0; while (enterword[i] == '.') { counter = counter + 1; } printf("counter is %i",counter); } } [/dm_code_snippet] The above is my code which is intended to count no. of full stops but fails. The program compiles successfully with counting no. of characters. Reply https://cs50.stackexchange.com/questions/42256/readability-lab-help-counting-no-of-lines-in-text https://edstem.org/us/courses/176/discussion/975312[learn_press_profile] Author Posts Viewing 1 post (of 1 total) You must be logged in to reply to this topic. Log In Username: Password: Keep me signed in Log In Log in / Register