0
why does this code always cause Segmentation fault......
may be it is able to run on sololearn normally but as long as on my IDE,it gets mad🌚 https://code.sololearn.com/cwPPeirS6oyE/?ref=app
8 odpowiedzi
+ 3
You are using mid as the length of store, but you haven't initialized it.
mid and sbs are basically unused here.
instead of inn - (inn/10)*10, you can use inn%10.
+ 3
It seems like you want to sum the digits of your input, you don't need store at all, just do the sum right away.
+ 1
Sure, but you don't really need pointers here. Also, you have to understand that you need to assign a value to a variable before using it, otherwise it will contain a garbage value that doesn't correspond to anything.
Remove sbs, store, and cont, and do the sum with deld1 in your first loop.
+ 1
If you're still stuck, here is the solution:
https://code.sololearn.com/cgLvmu38kRwA/?ref=app
0
Zen as you can see the new edition,i change it as you told me but it don't output anything now.....
0
Zen Yeah, you're right, but from this code i want to know the reason for which My code make this mistake,And the true use of the pointers. May I take more of your time?
0
thanks a lot for your patience:)
0
Zen thanks a lot for your patience.your code is really helpful:)