Just learning function is not very understand why devc and written in the codeblocks void complains, but would not be in the vc + +, the questions just write simple calculator, bosses on whether can use the void, but why in the two other compilers and why would an error? But three compiler can be run, and if you don't write the return, and vc + + 6.0 in codeblocks or can be, in devc still won't do,,, ask bosses explanation!
This problem is actually don't need to return to what is written in the following function what to return...
Vc + + 6.0
Devc
Codeblocks
CodePudding user response:
Rigorous,
It is said that the rigorous method is can't use void, and can not return
CodePudding user response:
reference response: 1/f, qian dream life rigor, It is said that the rigorous method is can't use void, and can not return reference response: 1/f, qian dream life rigor, It is said that the rigorous method is can't use void, and can not return But the problem is there has been a return value in the function, why can't use void,,, beginners void return these is not very good... CodePudding user response:
He said to him can't use to int and just return a 0 or 1, Has no effect on your study now, I don't really understand, Don't care about it now, actually later also don't need to care about it, later will slowly understand, probably The main function of the return value is to the caller, or starter, or operating system, should be CodePudding user response:
may be a different operating system regulation is not the same as CodePudding user response:
This should be the problem of the compiler syntax parsing, entry functions are generally compiler specifies the return type, you don't follow, some compiler error, some warning, some have no reaction, CodePudding user response:
Void is empty of meaning, Any function will have a return value type, including the main function, as the main function of words are basically int main () Then void is also a kind of types, but this type is empty Because is empty, so don't need to return Because the return type is defined by the function of writing in front of the function name type As to why some complains on different compilers, some will pass, this is the version of the reason, specific I also not too clear, anyway is some compiler version, not updated his support for the c language, like what c99 Over over CodePudding user response:
refer to the second floor rainbow centrifugal response: Quote: reference response: 1/f, qian dream life Rigorous, It is said that the rigorous method is can't use void, and can not return reference response: 1/f, qian dream life rigor, It is said that the rigorous method is can't use void, and can not return But the problem is there has been a return value in the function, why can't use void,,, beginners void return these is not very good... The main function is can't use void, each compiler different syntax CodePudding user response:
Standards have never void main this kind of writing, has always been int main CodePudding user response:
The main function of the standard signature is the int main (int arg c, char * argv []), the function type connector connected to the c/c + + runtime when required, the main function of the return value is commonly used as a process when the error code, so that the external program to determine whether a process to deal with work successfully, the operating system to start the process when the number of command line arguments and incoming content from its two parameters, the program can capture and processing, different compilers tolerance, basic can written above that kind of situation CodePudding user response:
Different compiler, the compiler version is different, they support different standards, such as some compilers support C11 C99, but some are not supported by the compiler, moreover void main () this form so far are not in the standard, so some compilers rigorous is not given, CodePudding user response:
Compiler, the compiler is not the same check syntax is different also, old compiler support of C, C + + old grammar style, new compiler support, therefore, should according to the compiler to decide is to use an int, or void, New compiler suggested int, because int universal use CodePudding user response:
Void is a long time for a long, long time for a long, long time for a long, long time for a long, long time for a long, long time for a long, long time for a long, long time for a long, long time for a long, long time a long time the use of the long, long ago, before the compiler can pass CodePudding user response:
Write, main must return int