![]() Note that we do not perform the slightest control of possible errors: it is possible that the requested memory block cannot be obtained. Rever[strlen(line)) = 0 // MUY IMPORTANTE el 0 final. ![]() The correct way to do what you want would be to use dynamic memory, being such that thus: #include ![]() and you try to assign the value returned by your reverse( ) function to it, which is an unsupported operation and what gives you the error you indicate. ![]() With which you re-book a pointer formation to char. Then, in the while( ), you make the same mistake again: char *rever For any conditional expression if we are using assignment operator() in-stand of comparison () then mostly c++ expression must be a modifiable lvalue error occurs. What you want to do is char rever Ĭonsidering that rever is a automatic variable, whose lifetime is limited to the time it takes for your function to execute, you will end up returning a pointer to a memory area that no longer contains what you expect.Īdditionally, using a variable as the size for a formation is allowed in C99, but is optional in C11. Normally these type of c++ error occurs in conditional statments. You are declaring a formation of pointers to character, which is not what you intend. I have the following function, to invert a line of text: char *reverse(char line)' but argument is of type 'char **’Įxtern int fputs (const char *_restrict _s, FILE *_restrict _stream)
0 Comments
Leave a Reply. |