#include<stdio.h> #include<string.h> int main() { char str[]="This is rajeev\n"; char str1[10]; memset(str,'0',4); printf("%s",str); memcpy(str1,str,10); printf("\n this is string 1\n"); printf("%s\n",str1); return 0; }
Output is : 0000 is rajeev this is string 1 0000 is ra0000 is rajeev it copies 10 characters from str to str1 so the printing 0000 is ra is Ok what abt the repeating result? -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.