Lec14a C
Lec14a C
Array: Typed collection of values indexed by nonnegative integers. Type and size must be known at compile time, except in the case of formal parameters:
int a[20]; void sort(int b[], int n);
5 j
1024
1032
General Rule:
Given declaration T *ptr; (ptr + k) points to location ptr + k sizeof(T)
22
23
Example:
int strlen(char const *str) { int n=0; for( ; *str != \0; str++) { n+=1;} return n; }
24
Caution: Programmer must guarantee that dst has been allocated enough memory to store src
25