We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Since your variable input_string is an array of type 'char':
charinput_string[105];
In the scanf we scan each characters and store them in an array (here an array with a size of 105) of type char. So all values in the array are of type char.
A string is a chain of characters: 'a' is a char but "hello" is a string.
So if we want to output the array all at once we use a %s, if we want to output just a char we use %c.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Day 0: Hello, World.
You are viewing a single comment's thread. Return to all comments →
Since your variable input_string is an array of type 'char':
In the scanf we scan each characters and store them in an array (here an array with a size of 105) of type char. So all values in the array are of type char.
A string is a chain of characters: 'a' is a char but "hello" is a string.
So if we want to output the array all at once we use a %s, if we want to output just a char we use %c.