0

Why error here?

#include <stdio.h> int main() { char a[5]; gets(a); printf ("char#: %s",a); return 0; }

18th Feb 2022, 5:54 PM
KNOWLEDGE & LEARNING
KNOWLEDGE & LEARNING - avatar
7 Answers
+ 4
the function gets() has been removed from C11 standard
18th Feb 2022, 5:59 PM
Мартин 😑🎵
Мартин 😑🎵 - avatar
+ 3
You can use fgets() Try : fgets(a, 5, stdin);
18th Feb 2022, 6:58 PM
Jayakrishna 🇮🇳
+ 1
https://stackoverflow.com/questions/34031514/implicit-declaration-of-gets loot at this you can use it your code works bit its deprecated
18th Feb 2022, 6:00 PM
Мартин 😑🎵
Мартин 😑🎵 - avatar
0
So what I should use
18th Feb 2022, 6:00 PM
KNOWLEDGE & LEARNING
KNOWLEDGE & LEARNING - avatar
0
Thanks a lot.
18th Feb 2022, 6:04 PM
KNOWLEDGE & LEARNING
KNOWLEDGE & LEARNING - avatar
0
Try puts(a) instead of printf
19th Feb 2022, 5:46 PM
A J
A J - avatar