C - warning: assignment makes pointer from integer without a cast -
I have no clue that I get this warning in my variable and return value match. I have pasted under the variable, for that assignment and function of that variable (return value and all)
char * menuMsg; / * Menu options are used to print * / menuMsg = printMenu (); Char * printMenu () {Fixed four messages [250] = "Choose an option below: \ n"; Strcat (Message, "(1) List all the files on the server \ n"); Strcat (Message, "(2) Recover file from server \ n"); Strcat (Message, "(3) Recover all files from server \ n"); Nomad (Message, "Enter your selection:"); Return message; }
Why would I get this error as a clue? For me, they prepare the conditions for all types of announcements.
This is because you are calling the function before declaring the undeclared functions as Int
is considered to be back, which explains the error.
printMenu ()
Before defining the function that is calling, or add a prototype:
char * printMenu (zero) );
And make sure that you do not have a valid code for zero
, ()
accepting a parameter.
In addition to this, whenever you call printMenu ()
, your code breaks down, call it strcat ()
four times Will cause the menu text to grow and grow and ultimately cause buffer overrun.
Comments
Post a Comment