gets()

Jun 30, 2014 at 3:41am
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);
    }
}

Jun 30, 2014 at 3:44am
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.
Jun 30, 2014 at 3:50am
jus C language
Jun 30, 2014 at 3:59am
Topic archived. No new replies allowed.