Saturday, April 24, 2010

Will it work?

#include<string.h>
int main()
{
printf(strcat("www.newtech4u.co.cc","!");
return 0;

}


Yes ,it will definitely work.  and display output as

www.newtech4u.co.cc!
*. strcat function concatenate the two string.

  • strcat(string,"!"); will work because ! is enclosed within double quotes and it is considered as string.
  • strcat(string,'!'); will not work because ! is enclosed within the single quotes,it is considered as character.

2 comments:

its compiler dependent. Ideally strcat supposes that destination string should be large enough to hold the combined output. Failing which it may(will) lead to seg-fault.

You are a very specialized blogger. I have joined your feed about Yes ,it will definitely work and display output as and look forward more of your outstanding blog posts,
dissertation writing

Post a Comment