+ 1
Why to write "return 0 ;" when function is (int main)
12 Respuestas
+ 2
deep jani, if you are a programmer then you should have to know that every function has its return type like int,float or void etc.. when main method is called with integer return type then will have to write return 0; because 0 is a integer and it return 0.
+ 1
if its a char then can we write
return a;
+ 1
main method is called either int main() or void main()
and mostly void main is not used in c++ .
+ 1
char func ()
{return a;}
is it legal
+ 1
you can use return int; or return(int);
but in char you can not use as return char;
follow this code to know more
#include <iostream>
using namespace std;
char printSomething() {
return('a');
}
int main() {
char c;
c=printSomething();
cout<<c;
return 0;
}
this code will generate output char (a). by returning it from the function.
+ 1
yes return a; in that program because a holds the value of 'g'
and this will produce output 'g'.
+ 1
tera account ke khilaf sakth kadam uthaya jae aisy developers se request karoonga tum is app pe rahne yogya nhi ho virus ho tum.
+ 1
thik h jaa jo karna h kar
0
no I mean
char printSomething(){
char a='g';
return a;
//what will happen if I write return 0
}
int main (){
char c;
c=printSomething();
cout << c;
return 0;
}
0
output will nothing from this code.because you are using return 0;
0
can you correct it
0
nahi hota h to naa bol