Warning: return from incompatible pointer type in C

Well, yes? The function is declared to return char *, but you return i1 which is the input argument and has type int *. You might mean to return the newly allocated string dum, and perhaps also fill it with the data that was read using fgets() to the separate character array input. In this case, you need to copy the data over, … Read more

Return char[]/string from a function

Notice you’re not dynamically allocating the variable, which pretty much means the data inside str, in your function, will be lost by the end of the function. You should have: Then, when you call the function, the type of the variable that will receive the data must match that of the function return. So, you should … Read more

C# compiler error: “not all code paths return a value”

You’re missing a return statement. When the compiler looks at your code, it’s sees a third path (the else you didn’t code for) that could occur but doesn’t return a value. Hence not all code paths return a value. For my suggested fix, I put a return after your loop ends. The other obvious spot – adding an else that had a return value to the if-else-if – … Read more