DEV Community

loading...

what is buffer in c/c++?

ramkshukla profile image Ram Kumar Shukla ・1 min read

Buffer is a term that refers to a block of computer memory that serves as temporary storage area is called buffer. All standard input and output device contains an input and output buffer.
Some of the example of the buffer...

  • Computer which uses RAM as buffer.
  • In a video streaming a sections of the movie you are streaming downloads to your device to stay ahead of your viewing.

Data can placed in software buffer before it is processed, writing data to a buffer is much faster than direct operation.
using a buffer while programing in C/c++ speeds up calculation process. Buffers come in handy when a difference exists between the rate data is received and the rate it is processed.

If you want to store a array of characters after a some input to store that in desired location, then you must need to clear unwanted buffer first so as to get the next input in desired location.

cin.ignore() is used to ignore or clear one or more characters from the input buffer.

Discussion (0)

pic
Editor guide