char * The_Function ( int Element_Count , char Padding ) { char Store [ Element_Count ]; memset ( Store , Element_Count , Padding ); return &Store[ 0 ]; }
are reason why you are committing suicide by returning the address of a automatic variable?
Well, the function would do that if it actually compiled without errors, which it doesn't. Non-constant array sizes aren't legal in C.
@OP: What's this, homework? "Find all the errors"?
What does this have to do with any of the Keil tools?
Christoph, I also don't like the attitude of the OP. So I wrote my reply in such a way that will force him to learn something before addressing the problem, or to commit suicide ;-)
"Non-constant array sizes aren't legal in C."
Legal in the chocolate flake version?
(Hope the OP is not sensible enough to understand that - Nah)
Three lines of code in the body and not one line correct.
Look on the bright side: There's only one error per line, and the error in the last line wouldn't cause a compiler error.
;)
"Three lines of code in the body and not one line correct."
With the Arm compiler and --C99 option and maximum warnings, I can compile the function without errors.
Ok. I have to include string.h and the return value is obviously nonsense, and there is another parameter error, but it compiles without warning or error.
No good with C51, since it does not support much (any) of C99.
en.wikipedia.org/.../99_Flake
Take for example a closer look at the parameter order for the memset() call - the compiler can't see this problem...
... software
Nope, didn't when I tried it here.
Clearly it's wrong - as in unintentional.