+ 2
There is a mistake in this code .i couldn't find it .please help me .
C programming https://code.sololearn.com/cJaY5AVpTeI0/?ref=app
5 ответов
+ 3
Please review the lesson, seems you're still unsure which type is appropriate for a purpose. You use `int` for asking a person's name when you should be using `char` array.
+ 2
Don't use gets()
Instead, try like this:
scanf("%d", &name);
+ 2
Okay thank u
+ 2
Deshani Malawana.
If you are taking a single string input then it is recommended to use scanf() and never ever use gets().
Next if you are taking a character array as input then I don't think that you can pass it to switch().
Also the cases inside switch() are integer values which is not compatible to the type you are passing to it.
Edit: int name; Why is name an integer type? You are confused and have not understood variable type declaration.
+ 2
Thank you for your early response