This program sounds the bell!
Solution 1:
ASCII character 7 is the BELL character, and it's represented in C as \a
. Some terminals will produce a beep when this character is output on the terminal; nowadays, many don't. (I'm looking at you, Ubuntu.)
Solution 2:
Back in the dark ages when ASCII was codified out of the ashes of BAUDOT, a terminal was a large chunk of iron that hammered ink onto paper, often included a paper tape punch and reader, and interpreted keystrokes to generate an asynchronous serial signal at a few hundred baud with spinning wheels and relays.
In case an operator fell asleep to the soothing noises of it hammering out text, it had an actual bell it could ring. The character coded 007 in octal, 0x07 in hex, or as \a
in a C character or string constant rang the bell when received.
As terminals became smaller and implemented with few or no moving parts, the physical bell was replaced by a beeper.
Exactly what your terminal emulator (aka a Console Window in Windows, xterm or something similar in Unix) does when it is asked to display that control character is not well standardized today. It ought to make a noise or flash the window, but your mileage will vary.
Solution 3:
Have a look at this wikipedia entry: bell character:
In the C Programming Language (created in 1972), the bell character can be placed in a string or character constant with \a ('a' stands for "alert" or "audible" and was chosen because \b was already used for backspace).
Solution 4:
You'll hear a beep from your PC's internal speaker (not the external speakers or headphones you may have attached).