0

Second code is showing an error when I entered something as an input

30th Dec 2019, 4:09 PM
Ananya Garg
Ananya Garg - avatar
4 Respuestas
+ 2
What code ?
30th Dec 2019, 4:10 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 2
You will get only warnings not errors.. Use fgets() instead of gets(); Like ex: fgets(a, 100,stdin); gets() is not recommended when input is more length than its array size, it leads to unwanted results.. So hence warning....
30th Dec 2019, 4:22 PM
Jayakrishna 🇮🇳
+ 2
fgets(a,100,stdin); Do not use gets and you can read about it on web to find the reason.
30th Dec 2019, 4:23 PM
Avinesh
Avinesh - avatar
0
#include <stdio.h> int main() { char a[100]; gets(a); printf("You entered: %s", a); return 0; } This one
30th Dec 2019, 4:14 PM
Ananya Garg
Ananya Garg - avatar