parray.htm

来自「Thinking in C 电子书的源代码」· HTM 代码 · 共 23 行

HTM
23
字号
<html><font size="+1"><pre>
/* parray.c: Illustrates arrays & pointers */
#include &lt;stdio.h&gt;

int min(int* nums, int size) { // or int nums[]

    int* end = nums + size;	 // past the end
    int small = *nums;
    printf("sizeof nums == %u\n", sizeof nums);
    
    while (++nums &lt; end)
        if (*nums &lt; small)
            small = *nums;
    return small;
}

int main() {
    int a[] = {56,34,89,12,9};
    printf("%d\n", min(a, 5));	// 9
    printf("sizeof a == %u\n", sizeof a);
    return 0;
}
</pre></font></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?