"sonu" <sa****************@gmail.com> writes:
main()
{
char *ptr1,*ptr2;
ptr1=(char*)malloc(sizeof(ptr1));
gets(ptr1);
ptr2=(char*)malloc(sizeof(ptr2));
gets(ptr2);
printf("%s",ptr1);
printf("%s",ptr2);
}
[...] Pls any one help me bcoz i need it Urgent
A few things not yet mentioned in other responses:
Proper indentation is your friend, even for a small program like this
one. See any decent C textbook, or most of the code posted here, for
examples of proper indentation.
Please don't use silly abbreviations like "Pls" for "Please", or
"bcoz" for "because". They only make it more difficult to read what
you write, especially for readers whose native language isn't English.
And finally, never ever ever use gets(). Use fgets() instead.
(You'll need to deal with the '\n' character that fgets() stores in
the string, and with its behavior if the input line is longer than
your buffer.)
--
Keith Thompson (The_Other_Keith)
ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.