LZN's Blog CodePlayer

Scratch Notes for Stanford CS107: Programming Paradigm Ch05

2020-10-20
LZN

L5: Generic Lsearch - Prototype

Notes

LSearch

First review the lsearch function:

void *lsearch(void *k, void *base,
                int n, int elemSize,
                int(*cmpfn)(void *, void *))
{
    for (int i=0; i<n; i++){
        void *elemAddr= base+i*elemSize; //01
}

01: This is a strictly pointer arithmetic against a typeless (void *) pointer.

Appendix

Glossary

ebb 退潮 mantissa 尾数

Updated 2020-10-20


下一篇 METCTM1

Comments

Content