+ 1

Fgets segmemtation fault/core dump

So ive been using fgets, i know that thr syntax is Void fgets(file, size, in stream) And this works perfectly in this code on linked list https://code.sololearn.com/c3cday2jXsWA/?ref=app However using the same exact code word for word in this other program, doesnt work https://code.sololearn.com/c1QQatX4H5jZ/?ref=app If anyone could help me error check my code it would be appreciated, just need summation checked, the other was just for example purpose

12th Sep 2020, 5:53 PM
Robert Atkins
Robert Atkins - avatar
3 Antworten
0
in both codes *input pointer does not point to anything, it's not initialized.
12th Sep 2020, 6:09 PM
Bahha‚Ķ£
Bahha‚Ķ£ - avatar
0
Bahhaūüźß yes, but it still works in the linked list code without initialization, even after initializing in the summation code with the value NULL it still provides the same error on the fgets function
12th Sep 2020, 9:10 PM
Robert Atkins
Robert Atkins - avatar
0
it doesn't work in linked list too, where does *input point to? running the code warns about using it uninitialized. where does fgets put the stdin it receives, it doesn't make any sense. a pointer has to point to something accessible for it to be useful.
12th Sep 2020, 11:25 PM
Bahha‚Ķ£
Bahha‚Ķ£ - avatar