+ 1
string input in C
I am trying to make a Task manger (To do list) program where I can add, remove or view tasks. then mark it as completed.. etc. But dealing with strings is kind of difficult to me. Please help me at this point here: What is the problem with scanf function in case 1? https://code.sololearn.com/cI6z8YPESTjp/?ref=app
6 odpowiedzi
+ 5
rah123 ,
> 2 issues are creating an infinite loop:
using this line: goto task_list;
the switch case does not handle the number `4` from input, so to exit the program is not possible.
+ 4
This can be looks like:
https://code.sololearn.com/ctOqWPLmlOda/?ref=app
+ 1
try this in case 1 :-
case 1:
printf("Enter task: ");
scanf("%s",task_list[i]);
printf("%s\n", task_list[i]);
printf("Task added!\n\n");
if(i<NUMBER_OF_ELEMENTS) {
i++;
choice = 4;
goto task_list;
}
printf("There are no task left\n");
goto task_list;
+ 1
Printf("enter string");
Scanf("%s",&str);
// string input from user in c
+ 1
I would go at this project using structs and a linked list. Are you still working on it?
0
should I make it with if instead?