Problem with C
Posted: Sun Jul 28, 2013 5:43 am
Hi i am quite new to C and I have an issue with it.
I am developing a x86 emulator here is some test code that's trying to point to an index in an array.
The reason for this is so if you change an 8 bit register or a 16 bit register they will both update. The problem is I get warnings
I am developing a x86 emulator here is some test code that's trying to point to an index in an array.
Code: Select all
unsigned int *reg_16[16];
unsigned char *reg_8[8];
reg_16[0] = ®_8[4];
reg_16[1] = ®_8[0];
reg_8[4] = 6;
reg_8[0] = 4;
printf("0x%x", *reg_16[0]);
Also my code is slightly wrong how can I change the 16 bit integer by char without changing its datatypecpu.c: In function ‘cpu_exec’:
cpu.c:18: warning: assignment from incompatible pointer type
cpu.c:19: warning: assignment from incompatible pointer type
cpu.c:21: warning: assignment makes pointer from integer without a cast
cpu.c:22: warning: assignment makes pointer from integer without a cast
x86Emu compiled!