◀ getline() versus cin▶ What Segmentation Fault Really Is Amazon
A Taiwanese tourist walked to the foreign currency exchange center and asked teller to exchange his US$500 to NT currency.
“Why do I got $15000 when I use $18000 get US$500 2 day befo? You think I speak no good english’ and you kan cheat on me?”
“No, sir. This is because of fluctuations.” (Does it sound like fxxx you Asians?)
“Fxxx you Americans $%#@[email protected]
So you see, a segmentation fault in your program is even worse than that in a language – at least they are talking but your program isn’t.
Segmentation fault is something every C or C++ programmer needs to be comfortable dealing with because it happens so often. Most programmers know what it is on some level but they don’t know about it too well. That’s what this chapter is dedicated to - help you understand what segmentation fault really is and how to best avoid it.
Let’s get started!
◀ getline() versus cin▶ What Segmentation Fault Really Is