what happens if you do this ... printf("test %x"),variable; <= unexpected behaviour ... or please explain. No warnings, no errors from compiler. Is this only in the evaluation version? Kind regards
what happens if you do this ... printf("test %x"),variable; Undefined behaviour combined with a no-op that makes it impossible to inspect the return value of that printf() --- but that's OK, because you don't even know if the printf() will ever return, so its return value wouldn't do you any good, anyway. <= unexpected behaviour ... I should hope so ;-). It's a serious error to expect any behaviour from the above, so yes, whatever behaviour you get should be unexpected.
printf("test %x"),variable;
"Well, it's perfectly legitimate 'C'." I'd better qualify that: it is syntactically correct 'C' that probably invokes undefined behaviour, and may not work as expected, depending on what your expectations were.
"or please explain." Well, it's perfectly legitimate 'C'. Look up the comma operator in your 'C' book.
That'd be:
printf("test %x",variable);
View all questions in Keil forum