c puzzle #2

I thought the following program was a perfect C program. But on compiling, I found a silly mistake. Can you find it out (without compiling the program :-) ?
#include<stdio.h>

void OS_Solaris_print()
{
        printf("Solaris - Sun Microsystems\n");
}

void OS_Windows_print()
{
        printf("Windows - Microsoft\n");

}
void OS_HP-UX_print()
{
        printf("HP-UX - Hewlett Packard\n");
}

int main()
{
        int num;
        printf("Enter the number (1-3):\n");
        scanf("%d",&num);
        switch(num)
        {
                case 1:
                        OS_Solaris_print();
                        break;
                case 2:
                        OS_Windows_print();
                        break;
                case 3:
                        OS_HP-UX_print();
                        break;
                default:
                        printf("Hmm! only 1-3 :-)\n");
                        break;
        }

        return 0;
}

4 comments:

  1. hyphen is not allowed in names
    void OS_HP-UX_print()

    ReplyDelete
  2. Here the function name is with the " - " symbol. So replace it with " _ "

    ReplyDelete
  3. DATA TYPE MISMATCH...

    ReplyDelete

Your answer for the question

Related Posts Plugin for WordPress, Blogger...