Home »
C solved programs »
C basic programs
C program to make a beep sound
Generate beep sound in C language: Here, we are going to learn how to make a beep sound in C programming language?
Submitted by Nidhi, on July 21, 2021
Problem statement
The "\a" escape sequence is used to make a beep sound i.e., it is used to generate a tone sound on the speaker. The beep sound can be used for the debugging or any other purpose.
C program to make a beep sound
The source code to make a beep sound is given below. The given program is compiled and executed using GCC compile on UBUNTU 18.04 OS successfully.
// C program to make beep sound
#include <stdio.h>
int main(int argc, char* argv[])
{
printf("Beep sound started\n");
printf("\a");
printf("Beep sound stopped\n");
return 0;
}
Output:
Beep sound started
Beep sound stopped
Explanation
In the main() function, we used "\a" escape sequence to make a beep sound.
C Basic Programs »