Hi, I've been working on my code, and I'm running into this problem but I do not know what to do with it because I can't seem to find relevent help online.
This is the segment of code which has problem. My question. Does the program pauses after gets(word) to wait for the user to input a string?Code:printf("\nPlease input the word you wish to add (enter any number to exit)"); gets(word); if (isdigit(word)) return; //terminates function if data is numeric printf("\nWhere do you wish to add the new node after (0 to add at top)?"); scanf("%d",&addPlace);
beacause I keep getting an output like this:
Please input the word you wish to add (enter any number to exit)
Where do you wish to add the new node after (0 to add at top)?_
where the underscore is asking for input in the console from the user.
when I add these code to the bottom of the above code:
And in the above input place i key in something like "123",Code:printf("string:%s", word); printf("\nnumber: %d", addPlace);
I get an output of:
What should I do? How can I get string inputs reliably? And I have seen suggestions to abandon gets and use fgets? I'm confuse. Thanks for any help given.