C programming language 30 days - (f)

  === === array

  1. The definition and use of arrays

  format:

    Data type array name [number of elements]

    The number of elements: the array representative of the number of the same data type variable

    Index: is used to indicate a particular element in the array.

  === === Code

#include<stdio.h>

#include<string.h>

#include<stdlib.h>

int len = sizeof(scores) / sizeof(int);

 

  sizeof (int); // determine the size of an integer variable

===

  printf("%d\n",scores[0]);

  int scores[10];

  for(int i = 0;i<10;i++)

  {

    scanf("%d\n",&score[i]);

  }

  system("pause");

====== 06_05 array initialization and memory structures ====

View address process: 1 print out the address 2, debugging - Window - Memory

Memory address //% p to print variable is unsigned hexadecimal format printing.

  printf("%p\n",scores);

  printf("%p\n",&scores[0]);

  printf("%X\n",&scores[0]);

=== === difference

  printf ( "% p \ n", name of the array);

  printf ( "% p \ n", array elements);

+1 array elements, a variable type movement

+1 array name, move to the array last.

===== ==== 06_06 ten piglets weighed

==== ===== 06_07 array of Retrograde

  In addition to the traditional use of temporary variables as intermediary, but also the first digital needs replacement is applied to the first word, and then subtract that number.

=====06_08

 

Guess you like

Origin www.cnblogs.com/dagailun/p/12397891.html