error in output due to gets()...as it can be seen in the image ... program prints 0 before waiting for user to enter the string. I need to read a string of "click X" format where X is a integer. Is there any alternative to gets() to use in this situation?
 #include<stdio.h>
#include<stdlib.h>
int main()
{
    int n,k,i;
    char action[10];
    int *open;
    scanf("%d%d",&n,&k);                                    
    open= calloc( sizeof(int),n);               
    for(i=0;i<n;i++)
    {
        open[i]=0;
    }
    for(i=0;i<k;i++)
    {                                                     
        //gets to read an input  as "click 1"
      gets(action); 
      printf("%d\t%c",i,action[6]);     
    }
    free(open);                                                         
    return 0;
}

 
     
    