- 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.
AI, Data Science, & Programming for Small Business Applications & Large Enterprises › 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 › Converting string to character for counting number of characters
Tagged: arrays, c, get_string(), scrabble lab problem, string type, strlen
[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) { string enterword = get_string("input"); printf("enterword %s", enterword); }
[/dm_code_snippet]
After taking input text that user enters, I intend to count no. of characters. Since initially the user enters string type, it appears that I need to convert string type to char type. After that, count no. of characters by a temporary counter variable.
Help appreciated how to convert string type to character type.
Reply
https://edstem.org/us/courses/176/discussion/951606?comment=2159746[learn_press_profile]