What is the most efficient way to take input of a character array or string of 25 ASCII characters using scanf?
They are not formatted, just a sequence of character. i.e. ABCDEFGHIJKLMNOPQRSTUVWXY
One more point is that, after input I have to find a sequence of character within this string, so it there any benefit in using 'string class' or should I just 'scanf and char array', cause I know my constrains.
Suggestion both considering following operation and not, is appreciated.
If stream points to an output stream or an update stream in which the most recent
operation was not input, the fflush function causes any unwritten data for that stream
to be delivered to the host environment to be written to the file; otherwise, the behavior is
Note that input streams and update streams where the most recent operation was input fall into the "otherwise" part of the definition. stdin is an input stream, so fflush(stdin) invokes undefined behavior.
Is it possible to know what is the undefined behavior?
Undefined behavior is by definition undefined. Anything can happen. I've heard cases of undefined behavior frying hardware, or corrupting system files, so it's far from harmless. And I suspect that's why people always look for descriptions of what might happen, they want to weigh the risks.