Write a program in ‘C’ language, which accepts a text string from a user and prints its reverse order.
Write a program in ‘C’ language, which accepts a text string from a user and prints its reverse order.
Share
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Here's a simple C program to accept a text string from a user and print its reverse order:
Explanation:
text
to store the input text string provided by the user.fgets()
to read the input string from the user, ensuring that the input does not exceed the size of thetext
array.\n
) from the end of the input string usingstrcspn()
.strlen(text) - 1
) and ending at the first character (0
).