What does it mean by buffer?

后端 未结 8 1212
自闭症患者
自闭症患者 2020-12-04 05:04

I see the word \"BUFFER\" everywhere, but I am unable to grasp what it exactly is.

  1. Would anybody please explain what is buffer in laym
8条回答
  •  孤街浪徒
    2020-12-04 05:29

    Buffer is temporary placeholder (variables in many programming languages) in memory (ram/disk) on which data can be dumped and then processing can be done.

    There are many advantages of Buffering like it allows things to happen in parallel, improve IO performance, etc.

    It also has many downside if not used correctly like buffer overflow, buffer underflow, etc.

    C Example of Character buffer.

    char *buffer1 = calloc(5, sizeof(char));
    
    char *buffer2 = calloc(15, sizeof(char));
    

提交回复
热议问题