+ 4

I have a problem with "sololearn compiler" sometimes I want to cout a var but it give me "no output" why

7th Nov 2017, 5:14 PM
Coder++
Coder++ - avatar
16 odpowiedzi
+ 9
~swim~, thanks for the great explanation :)
8th Nov 2017, 2:54 AM
Shamima Yasmin
Shamima Yasmin - avatar
+ 8
int size(10); Is it right? I'm not sure though.
7th Nov 2017, 5:42 PM
Shamima Yasmin
Shamima Yasmin - avatar
+ 3
thanks for the information swim
7th Nov 2017, 10:34 PM
Coder++
Coder++ - avatar
+ 2
"int size(10); Is it right? I'm not sure though." correction please?
7th Nov 2017, 6:15 PM
Coder++
Coder++ - avatar
+ 2
"You initialize int size to 10 and get Segmentation Fault in this line: distance[size]=discalc(cityX[i],cityX[j],cityY [i],cityY[j]); thus your program crashes before producing output. So change int size(10); to int size = 0; or int size(0); if you really want to use that fancy int constructor." thanks
7th Nov 2017, 6:33 PM
Coder++
Coder++ - avatar
+ 1
post your code so people can help
7th Nov 2017, 5:18 PM
Jeremy
Jeremy - avatar