Notes: Things to Avoid in C/C++
September 30, 2008 / Kyle Sun / 0 Comments
ref: Things to Avoid in C/C++
- gets(): no internal checks means a potential overflow, use fgets() instead
- fflush(stdin): effect undefined for input stream
- feof() to exit a loop
- system(“pause”): no need for this expensive function, use getchar() instead
- 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.
- void main()
#C#en#Notes#Programming