i have made this program for circular linked list. while printing stored data, it is not giving all inputs correctly. please tell me the changes to do in this program as fast you can.
We won't just fix it for you, but we'll help you figure it out.
Just by looking at the code, it looks very close. I'm guessing the problem is that your scanf() is accepting carriage returns so every other node in your list is a carriage return.
I don't understand: are you saying that you know you are putting carriage returns in the list and just don't know how to avoid doing that?
I don't have a compiler installed on this windows box so I can't compile and run your code to see what is going on.
If the above is correct, then you could do one of two things: either check to see if str == '\n' and don't insert if it is, or at the end of the loop you have to read in the carriage return and ignore it. (In the latter case, what do you want the desired behavior to be if the user enters multiple characters on a single line?)
Instead of checking for '\n' at each input you can try putting fflush(stdin); just before the input statement. It clears the input buffer before considering the character to be accepted.