If I write the following program, then there is no beep sound on running the code.
#include
int main()
{
printf(\"\\a\");
return 0;
Please list your operating system, how did you run your code, and if your computer has a beeper.
If you use Windows, maybe this Q&A How to make a Beep sound in C on Windows? would help you.
If you use a GUI desktop Linux distro, terminal emulator like gnome-terminal or xfce4-terminal have a preference option bell to check. Then, make sure your speaker works.
The code below works well for me:
/* name: bell.c
* run: gcc bell.c && ./a.out
*/
#include
int main(void) {
printf("\a");
return 0;
}
By the way, your code is not the problem.