#include<stdio.h>
#include<conio.h>
int main()
{
 char cyp[150],eng[26];
 scanf("%s",eng);
 gets(cyp);
 getch();
 return 0;
}

eng is accepted but only one letter is accepted for cyp.

what did you enter for cyp? gets() doesn't accept spaces.

You should NEVER EVER use gets() because it can corrupt your program's memory when you enter more characters than the buffer can hold. Instead, use fgets(), such as fgets(cyp,sizeof(cyp),stdin); scanf() with "%s" has a similar problem, you can use "%149s" to limit input to 149 characters plus 1 for null terminator.

 With reference to ur query,
 #include<stdio.h>
     #include<conio.h>
         int main()
             {
                 char eng[26];
                 clrscr();
                     //scanf("%s",&eng);
                         gets(eng);
                         puts(eng);
                             getch();
                                 return 0;
  }

@naveen1993

Please note:

  1. old post (now dead? - maybe you missed the date?)

  2. NOT portable code ...
    if one uses <conio.h> , clrscr, getch, etc...

  3. maybe you missed the CLEAR warning of @Ancient Dragon
    about NOT using gets!!!

    Please Google ... "C why DO NOT use gets"

  4. Your indent style is needing big improvement.

Your indent style is needing big improvement.

I'd hate to see his 1,000 line long program :)

Hey ... we all needed to start, somewhere ... and if some code compiles ... and IF it also gives the 'correct' output ... and if one is just beginning ... that can feel like it IS such a big success ... at first ...

I recall that it DID take me a long time before I wasn't terrorized by compiler errors and warnings ... and actually learned to 'like them' ... as I began to 'see' how they prompted me to fix the typos and other coding errors.

Yes you're right. My first few attempts I couldn't even get a Hello World program to work!

Hey, AD, how can I quote a respose? Or is that something I don't have access to?

As to your comment about 1000 line code modules, I have to admit that my stuff is non-standards, but I do try to keep it all in view.

First, highlight the text you want to quote and press Ctrl+C (copy to clipboard)

Next, in your post where you want the text to appear first insert > character then press Ctrl+V (paste from clipboard)

Here are some links where you can find good coding style guides. There is no one-way to code so select what you find useful to you.

how can I quote a respose?

There a question mark button on the editor that will take you to this page describing our Markdown formatting. You can also use any of the other buttons for quick formatting without manually typing it yourself. Just clicking the button will give you a default output, and clicking the button with text already highlighted will format it for you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.