Forum Discussion
Altera_Forum
Honored Contributor
15 years ago%d %i %u and %x are in fact for the C "int" and "unsigned int" types. This also works with alt_u32 because in the C compiler used with the Nios architecture, the int type is defined as 32 bits. This is true for most architectures, but if you want to be sure that your code is really portable, it would be best to cast it to (int) or (unsigned int) in the printf call:
printf("%d", (int)a);If you'll only run your code on Nios 2 you don't need to do that, but you never know when your code will be reused elsewhere...