- 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 2: [Arrays] – Functions, Variable and Scope, Debugging, Arrays, and Command Line Arguments › Creation of string s leads to automatically creation of an array s[ ]?
Tagged: arrays, string type, substitution project
A string type s is formed that takes hold of plaintext. Do that by automatically leads to creation of an array or do I need to create array for each character of string s. If an array is automatically created for s, what is the name of that array? Will it be s[0] for the first character? Sorry to raise this query while doing Substitution project as by this time, I should have already known this.
Reply
The get_string function creates the string, and then you assign it to “s”. After that, yes s[0] can be used to refer to the first character (etc.). You don’t need to do anything further to “create” the string or an array to hold it.[learn_press_profile]