Arrays

An array is an ordered set of data objects of the same type.

Declaration:
    int numbers[10];    /* Declare numbers[0] to numbers[9]. */

Example:
    for (i = 0; i < 10; i++) 
        counts[i] = 0;          /* Initialise the array (else garbage). */


Example:
    int a[4] = {10, 20, 30, 40};
    int *pa;

    printf("%d\n", a[0]);    /* print the first element of a*/

    pa = &a[0];

    printf("%x\n", pa);      /* prints the address of the first */
                             /* element of a */

    pa = a;

    printf("%x\n",pa);       /* also prints the address of the */
                             /* first element of a */


...previousup (conts)next...



About this document:

Produced from the SGML: /home/isd/public_html/_course_crash_in_c/_reml_grp/index.reml
On: 3/3/2003 at 17:43:41
Options: reml2 -i noindex -l long -o html -p multiple