gets()

the following code is a part of my program,here why is the compiler not waiting to get an input from gets()?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <stdio.h>
int main()
{
    int n;
    char filename[100];
    printf("press 1 to enter filename\n");
    scanf("%d",&n);
    if(n==1)
    {
        gets(filename);
    }
}

Are you trying to write C code? Or is this really meant to be C++, you don't seem to actually be using any c++ concepts anywhere.
jus C language
Topic archived. No new replies allowed.