Gets() is not declared

please tell me why the gets() func is not working here

hey @Sukanya, have you include stdio.h header file.

here is the code https://ide.codingblocks.com/s/106055

i have already done that

hey @Sukanya, gets() is not removed from C++14 as per official website of C++ .com. You can use fgets instead of gets.

here is article from officail website. https://en.cppreference.com/w/cpp/io/c/gets

okay, if i dont use gets() and take a string as the data type. Then strlen() func is not working with that. Is there any alternative function to find the length of a string?
Please help me run this code https://ide.codingblocks.com/s/106055

hey @Sukanya, if you are using string, then there is length() to calculate string.

here is example for you
string s;
cin>>s;
int l=s.length();

Thankyou, my doubt is solved. :slight_smile:

hey @Sukanya , if your query is resolved. Please mark this doubt as resolved and rate me on the basis of your experience.
rating option will appear when to mark this doubt as resolved

1 Like