+ 1
Plz help me🥺
I'm getting segmentation fault when testing this code. I tried so hard but can't find the error. The segmentation fault occurs when running. Plz help me https://code.sololearn.com/cCpr1H3LVPOJ/?ref=app
3 Respostas
+ 2
At first glance 'cse' 'mech' and 'eee' Record pointers are not initialized (they do not default to NULL), and the 'add' function tries to read them
+ 1
hmm, your code doesn't give me a segmentation fault, the output says that it didn't the department and then finds that department and asks a bunch of appropriate input and then uhh... it does nothing.
here was my input:
1
cse
rellot
45
35
357587
2
1
cse
rishi
21
45
357586
2
+ 1
Rellot's screwdriver yeah it just gets the input and stores it. It gave me segmentation fault because of the reason that I didn't initialize the pointers to NULL and tried to access the random memory segment they were pointing to, that resulted in error. Thank you for helping Angelo and @Rellot's screwdriver