Home > Back-end >  Microsoft pen try: C program error?
Microsoft pen try: C program error?

Time:10-24

# include

Void main (ret) int * {
Int a [3]={1, 2, 3};
Ret=a;
return;
}

CodePudding user response:

Int a [3]={1, 2, 3};
Thus define the function were recycled, the result is that the returned pointer to uncertainty

CodePudding user response:

The main function of the standard definition is
Int main (int arg c, char * argv []);
If this function is the main function, you shouldn't use such arguments and return values
If it is not the main function, don't the name
In addition, returning a pointer to a local variable cannot be

CodePudding user response:

Void the main?

CodePudding user response:

Mian only as the main function

CodePudding user response:

The main function is only 2 kind of writing is correct int main (); And int main (int arg c, char * argv []);


If the main is a function of other, because of the ret parameter is int * so the function call is not call,

CodePudding user response:

Agree with upstairs you mentioned two questions,,,

CodePudding user response:

There are two wrong
1. Void main (ret) int * mian function has two parameters of standard int main (int arg c, char * argv []);
2. Ret=a; return; Because the array is a local variable, the function body, did not exist, lead to ret to the not clear

CodePudding user response:

  • Related