c++ - Argument name in function prototype -
In the form of an EF function declaration, three things are necessary i.e. Return value type The name of the function (argument type). But the logic name is not required when I remove the logic name ( arr [] [maxcols]
) from the function prototype ( void readMatrix (int arr [] [maxcols]) Why the program generates an error;
)
In simple words.
Read Zero Matrix (Antar [] [Maxols]); // OK and no error zero read matrix (int); // But this error generates an error when the argument name is not mentioned in the function prototype.
Because is not related to [maxcols]
For an announcement without the name, type:
void f (int [] [maxcols])
and raw arrays are usually a poor choice. Use the std :: vector
or std :: array
.
Comments
Post a Comment