This program sounds the bell!

Viewed 59863

I'm a brand-new student in programming arena so I can't grasp this program written in my book that I have been following for a few days. The program is like this:

#include "stdio.h"

main()
{
 printf("\a");
}

What does this program mean? Does this program mean that we could hear a ringing bell? I can't hear any ringing bell sound!!!

13 Answers
#include<stdio.h>
int main()
{

    int i = 263;
    putchar(i);  // or you can directly use putchar(263);
    return 0;
}

This program produces a bell sound while you are on the output screen

the problem isnt about wheter your C program compiles its fully depend your terminal settings usually they make beeps using PC speakers that comes with laptop and PCs before UEFI exist

https://en.wikipedia.org/wiki/PC_speaker

i tested it using 2 laptops one of them were bought before UEFI even a thing and other bought after UEFI become common thing

i run echo -e '\a' on both test (both linux system with pcspkr module loaded) and sure the laptop before UEFI exist is beep other laptop just silent

Related