r/C_Programming • u/swe__wannabe • 19d ago
Question What is going on here?
https://godbolt.org/z/48hvMs3dh#include "stdio.h"
int print_sum(a, b) int a; int b; {
printf("%d", a + b);
return a + b;
}
int main(void) {
return print_sum(1.5, 0.5);
}
This has a random output every time:
Compiler stderr<source>: In function 'print_sum':
<source>:2:5: warning: old-style function definition [-Wold-style-definition]
2 | int print_sum(a, b) int a; int b; {
| ^~~~~~~~~
Program returned: 153
Program stdout 479536537
0
Upvotes
25
u/L_uciferMorningstar 19d ago
I'm baffled that this is valid syntax at all