AnsweredAssumed Answered

printf knows more than it should know ?

Question asked by robertthebobbert on Mar 26, 2013
Latest reply on Apr 15, 2013 by robertthebobbert

Hi !


I would be obliged if somebody could explain to me the behaviour of the printf - function in VDSP5.0 respective format specifiers:


unsigned short int e = 1;

     signed short int f = -1;


printf("\nResult e = %d", e );

printf("\nResult f = %d", f );


printf("\nResult e = %d", e );


This listing produces following output:


Result e = 1

Result f = -1

Result e = 65535


The variables e and f are showing the same bit pattern in memory: 0xffff


My question is:

Why does the printf function produces a different output although the specifier and the memory representation are the same ?