Solved
Forum Discussion
VViro
New Contributor
7 years agoHi Anand,
We have tried using Quartus 18 and at first sight we got expected result. But when we checked for memory address of C[2] it was already word aligned, so it was expected behavior. Can you please check below program with your system?
char c[10] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88};
printf("int starting c[0] = 0x%08x and address = 0x%08x\n", *(int*)(&c[0]), (int)&c[0]);
printf("int starting c[2] = 0x%08x and address = 0x%08x\n", *(int*)(&c[2]), (int)&c[2]);
// We are expecting following output:
// int starting c[0] = 0x44332211 and address = .....
// int starting c[2] = 0x66554433 and address = .....
Thanks,
Vasu.