Sunday, March 13, 2011

memset function

#include "stdio.h"
# include "string.h"
# include "malloc.h"
int main()
{
char *a= "Karthiken07";
char *b;

b=malloc(10*sizeof(char));
memset(b,0,100);

while(*b++=*a++);
printf("%s\n",b);
return 0;


}


OUTPUT:


Press any key to continue . . .


Note: Empty string is printed ......

No comments:

Post a Comment