c - Regarding macros -
I know what is the problem using the X-macro code
define # FILL_BUFF_1 (int *) (0x01, 0x02) #define FILL_BUFF_2 (int *) (0x03, 0x04) #define X (A, B) #define LOOK_UP \ X (0x13, FILL_BUFF_1), \ x (0x14 , FILL_BUFF_2) # Undef X #define X (a, b) An int pid_table [2] = {LOOK_UP}; #undef x #define x (a, b) b int * pid_buff_ptr [2] = {LOOK_UP}; Zero main (int argc, _TCHAR * argv []) {printf ("% d", (pid_buff_ptr + 0)); // displayed 0x02 printf ("% d", (pid_buff_ptr + 1)); // displayed 0x04 printf ("% d", * (pid_buff_ptr [0] + 1)); // do not work}
How do I create code above to access other elements in buffer?
I'm not sure what you're trying to do, but if I'm right properly estimated, you If so, you the following changes: to To print, you will do some experimenting: Of course, I could be wrong. Now, some other comments: pid_buff_ptr
includes an array of variable
, but if it is an alias or not
# need to change, FILL_BUFF_1 (int *) (0x01, 0x02) #define FILL_BUFF_2 (int *) (0x03, 0x04)
#define FILL_BUFF_1 define {0x01, 0x02} #define FILL_BUFF_2 {0x03, 0x04}
int * pid_buff_ptr [2] = {LOOK_UP} ;
int pid_buff_ptr [] [2] = {LOOK_UP};
printf ( "% d", pid_buff_ptr [0] [1]);
#lt; Stdio.h & gt;
before using printf ()
main ()
return integer
.. returns
int
, you should return it to int
Traditionally, 0
means success. #define > char
, You may have trouble in
Along with the above changes, I do not understand the need to sneak past -Processor. What are you really trying to do?
Comments
Post a Comment