- 1
What this said its time out
#include <stdio.h> void sp(r) { } int main() { int r; printf ("how many rows do you want"); scanf("%d",r); sp(r); return 0; }
3 Answers
+ 2
You are coding in C, right?
I think you forgot to put 👉& for your variable in the scanf line.
Your indentation in main() function isn't nice, but that won't stop anything from working.
Also, doesn't a void function still need a 👉return statement?
+ 2
Bong Rush Gaming YT read the error message / compiler warning carefully. You could find out the cause yourself. (added line breaks for readability)
*error message*
timeout: the monitored command dumped core
./Playground/runner.sh:
line 103: 12 Segmentation fault timeout "$runtime" "$output" = << "/usercode/inputFile"
*compiler warning*
e/file0.c: In function 'main':
./Playground/file0.c:
10:9: warning: format '%d' expects argument of type 'int *', but argument 2 has type 'int' [-Wformat=]
If I were you, I would google 'core dump' and 'segmentation fault'.
"timeout" is explained here:
https://man7.org/linux/man-pages/man1/timeout.1.html
And a question about "void sp(r)".
What made you save only 4 letters with the cost of readability (and a compiler warning, though not in Code Playground)?
Jeff.C a void function doesn't necessarily need a return. To exit the function halfway on a condition (and not execute the rest) it may be necessary, but when it's fully executed, it's not (no effect).
+ 1
Ok thanks for replying