0

What should I do to return 1

#include <stdio.h> void main() { int i=5; int j=7; int k=i+j; printf(s) ; return 1; }

8th Aug 2021, 7:50 AM
Ajoh Pv
Ajoh Pv - avatar
12 ответов
0
Ajoh Pv becz each language has its own features and rules c/cpp main function and java main function have difference . Becz in java we writing public static void main Here return type is void that's why we cannot use int . But yeah when you creating methods then you can use return statements .
11th Aug 2021, 1:00 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 4
return int in main().
8th Aug 2021, 7:51 AM
你知道規則,我也是
你知道規則,我也是 - avatar
+ 1
Ajoh Pv only execution start from main function This is function decleration void add(); This is definition void add() { } This is calling add();
8th Aug 2021, 10:36 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 1
Userdead #thanku
8th Aug 2021, 10:39 AM
Ajoh Pv
Ajoh Pv - avatar
0
Go back to C course, and check the topic with printf(), cuz it looks like you don't know how to use it
8th Aug 2021, 8:02 AM
Michal Doruch
0
Michael doruch thanks you are right, can u say what is calling function example, is it always main
8th Aug 2021, 8:32 AM
Ajoh Pv
Ajoh Pv - avatar
0
User dead can you say why return 0 is not there in java
11th Aug 2021, 7:51 AM
Ajoh Pv
Ajoh Pv - avatar
0
A. S where are you❓ from
11th Aug 2021, 3:41 PM
Ajoh Pv
Ajoh Pv - avatar
0
Ajoh Pv I am from IT world
11th Aug 2021, 4:48 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
0
U mean java has rules that is why it return s valid return type even though void
11th Aug 2021, 5:27 PM
Ajoh Pv
Ajoh Pv - avatar
0
Ajoh Pv as in main function its compulsory to write void if u will study starting of java in books or from any tutorials. You will understood better why we using void why not int .
11th Aug 2021, 5:32 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
0
Thanks indian
11th Aug 2021, 5:38 PM
Ajoh Pv
Ajoh Pv - avatar