Forum Discussion
Altera_Forum
Honored Contributor
19 years agoI think it is related to declaring a pointer vs. declaring an array.
Note, the *gr_data_written pointer is not declared anywhere nor initialized. Thus, the result should be undefined. When declaring, pointer and array are different. Garland --- Quote Start --- originally posted by itntest+oct 26 2006, 05:23 pm--><div class='quotetop'>quote (itntest @ oct 26 2006, 05:23 pm)</div>--- quote start ---
<!--quotebegin-david_cai@Oct 24 2006, 07:16 PM the question is not clear enough.
you'd better show a simple example.
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=18886)
--- quote end ---
--- Quote End --- Example: // in declaration file cyg_uint8 gr_data_written[5] = {1,2,3,4,5}; --- // in this other file# ifdef FIRSTWAY extern cyg_uint8 gr_data_written[];# else extern cyg_uint8 *gr_data_written;# endif showme() { printf ("%x", (int) gr_data_written); # ifdef FIRSTWAY output of printf is a ptr "4A178";# else output of printf is the value "1";# endif ----------- I thought it was supposed to be the same either way, but it wasn't. <div align='right'><{post_snapback}> (index.php?act=findpost&pid=18938)</div> [/b] --- Quote End ---