Yessir, point taken :)

Old habits die hard :)

Regards,

Sunil.


--- In [email protected], "Brett McCoy" <[EMAIL PROTECTED]> wrote:
>
> On Sun, Mar 2, 2008 at 3:59 PM, sunil_h_v <[EMAIL PROTECTED]> wrote:
> 
> > #include <stdio.h>
> >  #include <conio.h>
> 
> conio.h is not a standard header and is specific to the old Borland
> compilers (like Turbo C++)
> 
> >  #include <string.h>
> >  void main()
> 
> int main()  it's always int main()
> 
> >  {
> >   int i,n;
> >   char *s;
> >   clrscr();
> >   gets(s);
> 
> ouch... never use gets(). Let me repeat... never use gets()! It does
> not check the length of the input string so a user could enter in 100
> characters even if you only need... very dangerous
> 
> You also never allocated memory for s
> 
> >   n = strlen(s);
> >   for (i=0;i<n;i++)
> >     printf("%c",*(s+i));
> >
> >   printf("\n");
> >
> >   for (i=0;i<n;i++)
> >     printf("%c",s[i]);
> >
> >   printf("\n");
> >   puts(s);
> >
> >   printf("%s",s);
> >   getch();
> >  }
> >
> >
> >  I hope that satisfies your question.
> >
> >  Regards,
> >
> >  Sunil.
> >
> >
> >
> >  To unsubscribe, send a blank message to
<mailto:[EMAIL PROTECTED]>.
> >  Yahoo! Groups Links
> >
> >
> >
> >
> 
> 
> 
> -- 
> ------------------------------------------------------------
> "In the rhythm of music a secret is hidden;
>     If I were to divulge it, it would overturn the world."
>                -- Jelaleddin Rumi
>


Reply via email to