I am currently working on Turbo c++ to be precise on c language

1.6k Views Asked by At

This is my program code:

enter image description here

and the desired output is this (copied from https://www.javatpoint.com/c-gets-puts):

enter image description here

and the output I am receiving is this

enter image description here

I would be very pleased if anybody can highlight my mistake. Program Used: Turbo c++

1

There are 1 best solutions below

0
Mawg says reinstate Monica On

Change printf("You entered %c", s); to printf("You entered %s", s);

Read this page and see why it needs to be %s and not %c.

Good luck with your learning.

Btw, when you have a (larger) program which is working with no errors, you can post it on our Code Review site, and experienced coders will help you to improve it.

Also, I loved Turbo C++, probably before you were born ;-) but, please visit Software Recommendations and ask us to recommend a good development environment for you. It is very important that you get a good IDE, with an in-built debugger - the debugger is your best friend. Turbo C has one, it's just that the whole thing is ... almost as old as me :-/ Nothing wrong with it. It works. But other (free) stuff can make your life much, much easier, and will also get you more support and not so many use Turbo C nowadays.