Home > Back-end >  Consult, does not specify the functions of parameter, is what can preach to participate? thank you
Consult, does not specify the functions of parameter, is what can preach to participate? thank you

Time:01-16

Consult, the following procedures can be compiled, return 20, why function f2 without formal parameters, can preach to participate?
F2 ()
{
The return of 20;
}

Int main ()
{
Printf (" the result is=% d \ n ", f2 (100));
return 0;
}

CodePudding user response:

 Arthur c. : 3:1: warning: the return type defaults to 'int' [- Wimplicit - int] 
F2 ()
^ ~


Go by default, if you need to understand that such problems, can read the C standard, understand compiler syntax checking rules ~

CodePudding user response:

You this question, I think a lot of people are covered, don't know why, but does not affect your programming, is the cause of a lot of people are given a lot of people won't write,

These problems do not recommend probe, more exercise some programming logic, algorithms, techniques, such as

The problem of grammar let the compiler to check it

CodePudding user response:

The
reference 1/f, confident boy reply:
 Arthur c. : 3:1: warning: the return type defaults to 'int' [- Wimplicit - int] 
F2 ()
^ ~


Go by default, if you need to understand that such problems, can read the C standard, understand the compiler syntax checking rules ~

To ask what the default? There are books, document? Such as the C standard?
Where can you see?
Thank you

CodePudding user response:

Love the child.
This and how to calculate the motion around the earth have what differentiation?
Motion is relative, said to the sun orbiting in isolation is categorically, but with the earth at the origin coordinate system to give you the next study other planets made much trouble you know?

CodePudding user response:

reference oracleperl reply: 3/f
Quote: reference 1/f, confident boy reply:
 Arthur c. : 3:1: warning: the return type defaults to 'int' [- Wimplicit - int] 
F2 ()
^ ~


Go by default, if you need to understand that such problems, can read the C standard, understand the compiler syntax checking rules ~

To ask what the default? There are books, document? Such as the C standard?
Where can you see?
Thank you

The default means if there is no definition or declaration, according to the int to handle ~

CodePudding user response:

reference 5 building self-confidence boy reply:
Quote: refer to the third floor oracleperl response:
Quote: reference 1/f, confident boy reply:
 Arthur c. : 3:1: warning: the return type defaults to 'int' [- Wimplicit - int] 
F2 ()
^ ~


Go by default, if you need to understand that such problems, can read the C standard, understand the compiler syntax checking rules ~

To ask what the default? There are books, document? Such as the C standard?
Where can you see?
Thank you


Thank you for the great god
Default means if there is no definition or declaration, according to an int to handle ~

Are there any books or the official documentation?
I see K& R C said in the book, do not specify a function return type, then the default int
But for the parameters of the function, hypothesis is F () didn't say there are several parameters, also didn't say default is well yao type
thank you

CodePudding user response:

Don't look at the compiler source code, don't look at each other C/C + + statements corresponding assembly instructions, you will always be "tap",

CodePudding user response:

refer to 7th floor 4 teacher zhao response:
don't look at the compiler source code, don't look at each other C/C + + statements corresponding assembly instructions, you will always be "tap",

Thank you miss zhao to remind, you said that the compiler source code, C/C + + statements corresponding assembly instruction, where do I see?
Thanks to miss zhao

CodePudding user response:

No parameters is can pass parameters by default unless for void

 f2 () 
{
The return of 20;
}

F1 (void)
{
The return of 20;
}

Int main ()
{
Printf (" the result is=% d \ n ", f2 (100));//will not go wrong
Printf (" the result is=% d \ n ", f1 (100));//error
return 0;
}

CodePudding user response:

Old compiler problem,,,,,,,,

CodePudding user response:

refer to the eighth floor oracleperl response:
Quote: refer to 7th floor 4 teacher zhao response:
don't look at the compiler source code, don't look at each other C/C + + statements corresponding assembly instructions, you will always be "tap",

Thank you miss zhao to remind, you said that the compiler source code, C/C + + statements corresponding assembly instruction, where do I see?
Thanks to miss zhao

The Compiler source code: the primary Tiny C Compiler; The ultimate GCC/g + +
C/C + + statements corresponding assembly instruction: Windows VS20xx, open assembly instruction window when debugging; Linux g + +, GDB debugging, the layout of asm

CodePudding user response:

5250, 9/f, reference response:
no parameters is can pass parameters by default unless for void

 f2 () 
{
The return of 20;
}

F1 (void)
{
The return of 20;
}

Int main ()
{
Printf (" the result is=% d \ n ", f2 (100));//will not go wrong
Printf (" the result is=% d \ n ", f1 (100));//error
return 0;
}

Can I pass a few parameters? Parameter data types is what?
I carefully read the pointer or "C" in English, feel a statement of the function that chapter, introduction, after don't take no clarify concepts
For function has no parameters, the book is said "assumption is right"

For what is a function prototype, it is not clear,,
Seemingly int f (int a); This line must be function prototype
So the following code int f (int a) count function prototype?
Int f (int a)
{
return 1;
}

CodePudding user response:

refer to 12 floor oracleperl reply:
Quote: 5250, 9/f, reference response:
no parameters is can pass parameters by default unless for void

 f2 () 
{
The return of 20;
}

F1 (void)
{
The return of 20;
}

Int main ()
{
Printf (" the result is=% d \ n ", f2 (100));//will not go wrong
Printf (" the result is=% d \ n ", f1 (100));//error
return 0;
}

Can I pass a few parameters? Parameter data types is what?
I carefully read the pointer or "C" in English, feel a statement of the function that chapter, introduction, after don't take no clarify concepts
For function has no parameters, the book is said "assumption is right"

For what is a function prototype, it is not clear,,
Looks like
 int f (int a); 
this line must be function prototype
So the following code int f (int a) count function prototype?
Int f (int a)
{
return 1;
}


For no participation function, the parameter is not sure you can give it a set of multiple parameters, multiple types as long as you can put on the stack are theoretically there is no error but it is not recommended to do so is not safe,
 int f (int a); nullnullnullnullnullnullnullnullnull