0
Why this code throws error
About void main and loop #include<stdio.h> void main() { int i; for(i=1; i<=10; i++) printf("%d",i); }
8 Respuestas
+ 1
Felix Alcor yeah thanks you I rechecked it's fine
Thank you for your help 😊
0
it's int main() and not void main()
0
Felix Alcor what if I want to use void what chances i need to do
0
It is only a warning, not an error, to remind you that main should not be void. Console programs should return an int so shell scripts may report whether the execution was successful. It is conventional that if a program returns 0, then the run was successful, and non-zero means it was unsuccessful.
0
Laukesh singh You Code still works and Like Brian said it's just a reminder. When you don't Like the warning just use int main().
0
Felix Alcor yeah but I ran the code and I'm not getting expected output (if it just a warning than atleast code should run right?)
And what if I want to use VOID then what chances code required
0
Laukesh singh When I Run the Code I get the Output "12345678910" and that should be also the right Output by that Code and then behind that's the warning.
What's your expected output?
0
Change main() function.