home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sams Teach Yourself C in 21 Days (6th Edition)
/
STYC216E.ISO
/
mac
/
Examples
/
Day09
/
asize.c
next >
Wrap
C/C++ Source or Header
|
2002-04-27
|
773b
|
32 lines
/* Demonstrates the relationship between addresses and */
/* elements of arrays of different data types. */
#include <stdio.h>
/* Declare a counter and three arrays. */
int ctr;
short array_s[10];
float array_f[10];
double array_d[10];
int main( void )
{
/* Print the table heading */
printf("\t\tShort\t\tFloat\t\tDouble");
printf("\n================================");
printf("========================");
/* Print the addresses of each array element. */
for (ctr = 0; ctr < 10; ctr++)
printf("\nElement %d:\t%ld\t\t%ld\t\t%ld", ctr,
&array_s[ctr], &array_f[ctr], &array_d[ctr]);
printf("\n================================");
printf("========================\n");
return 0;
}