Notes: Things to Avoid in C/C++

ref: Things to Avoid in C/C++

  1. gets(): no internal checks means a potential overflow, use fgets() instead
  2. fflush(stdin): effect undefined for input stream
  3. feof() to exit a loop
  4. system(“pause”): no need for this expensive function, use getchar() instead
  5. scanf(): a. leaves stuff in the input buffer to mess up your next input. b. quite a big function. c. for string, same problem as gets(). d. for char, use getchar() instead.
  6. void main()