For example:When i tried running the following program, it just skipped the reading of str. Please explain the reason to this , and also which is right the way to do it?
#include<stdio.h>
#include<string.h>
void main()
{
char str[50];
int m;
scanf("%d",&m);
gets(str);
printf("\n%d",strlen(str));
}