+ 1
I have a question about C language .Why didn't it end when I entered 0 .
15 Answers
+ 4
tum kya karna chahte ho , aapka question not understand
+ 3
are you telling about return 0
+ 1
Why do you expect the program to end when you enter 0?
+ 1
Because I think when I type 0, it can end up outputting the list.
+ 1
Can you refer the piece of code that do that? The line that say that if the input is a zero tgen the program should print the list
+ 1
return 0; it's not gonna do what you want 🤭🤗🤗 read this: https://stackoverflow.com/questions/204476/what-should-main-return-in-c-and-c
In main() you call creat() and then in the next line, print()
So your program print the list right after creating it.
I don't know exactly when the program strops to create the list. What's the utility of "n" in the while of creat()?
+ 1
Anyway you just need to add a command to exit creat() when you scan a 0.
Also you don't need to put "f" in the structure. And since your structure contain only a name, you could use a 2D array. But if you are exercising on data structures go on.
+ 1
No, I mean when I use this program, I enter some data first, and then when I don't want to enter data, I enter 0, which ends the storage of data, but when I enter 0, the program does n' t end storage, so I want to know where I was wrong.
+ 1
How can print a charater value in my program
+ 1
You are welcome 🤗
As you can see the Q&A section has rules.
If you want help with your program create a question posting your code and explaining your problem.
0
You need to change the while condition to
while( p1->f )
And when you read "f" you need to type 0 not "f". If you type a character, rather than a number, the scanf with %d fails
0
Thank you for welcoming me
0
Try return(1)
0
Well, thank you very much. I know what I should do.