+ 1
Could anyone tell me what's the error in this code?
I've made this simple code for outputting the amount of vowels there're in a word, but something's not working. https://code.sololearn.com/c44G8oWEergb/?ref=app
7 ответов
+ 4
There was few errors in you code.
When you scan string using scanf() function, you can't give that strings size in it.
And while printing using printf(), also there you don't need to provide size of string.
I fixed those errors for you.
https://code.sololearn.com/c6O1DigbBcfp/?ref=app
+ 3
Aadhish Sriram
I don't think so it is possible to use that.
Because he wanted to make dynamic string...
He asked user that how much is the size of string and created a char array of that size.
+ 3
Surely. Aadhish Sriram
Some editors like turbo C/C++ don't allow to do that.
But as you can see in his code, it is possible.
+ 2
You can also use #include<string.h> and strlen() function for the length of the word for example here instead of asking the user for the length of the word.
It's more effective in a way you can few lines of code.
+ 1
Raj Chhatrala
We can create an array that way???
0
Thank you so much Raj Chhatrala!
0
Lack of bounds check in the scanf() method, which can cause buffer overflow.
Incorrect comparison operator (==) used in the for loop to check if the character is a vowel.
Reference to 'size' being used in printf() instead of 'word'
Cont being set equal to 0 instead of using if-statement and incrementing by 1 when a vowel character is detected