Why it is showing compiler error? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why it is showing compiler error?

#include <stdio.h> #include <string.h>   int main() {   char a[100];   int length;     printf("Enter a string to calculate it's length\n");   gets(a);     length = strlen(a);     printf("Length of the string = %d\n",length);     return 0; }

28th Mar 2019, 6:59 AM
Mahir Shadid
Mahir Shadid - avatar
2 Answers
+ 3
Mahir it worked fine for me when I removed the blank lines https://code.sololearn.com/c299GDIhjqnC/#c
28th Mar 2019, 7:51 AM
Tibor Santa
Tibor Santa - avatar
+ 2
This was from a teacher of mine. He said to me to copy paste and see what happens. I didn’t know it would show me an error. But thanks man!
28th Mar 2019, 8:30 AM
Mahir Shadid
Mahir Shadid - avatar