I'm trying to compile and display the address of each value into the arrays.
int i[10] = {1,2,3,4,5,6,7,8,9,10}, x;
float f[10] = {1,2,3,4,5,6,7,8,9,10};
double d[10] = {1,2,3,4,5,6,7,8,9,10};
/*int *p_i = &i;
float *p_f = &f;
double *p_d = &d;*/
int main(void){
printf("\n\tInteger\tFloat\tDouble");
printf("\n=======================================");
/* loop to show the address in each element that have the arrayes */
for(x = 0; x < 10; x++){
printf("\nElement %d\t%d\t%d\t%d", x+1, &i[x], &f[x], &d[x]);
// printf("\nElement %d\t%d\t%d\t%d", x+1, p_i++, p_f++, p_d++);
}
printf("\n=======================================\n");
}
I don't understand why if the syntax is right. Also I have search and the found code is almost the same.