[root@zt react-ddos-map]# cat test.c
#include <stdio.h>
#include <string.h>
#include <memory.h>
void main()
{
char * p = malloc(100);
memset(p, 0, 100);
strcpy(p, "i love bj");
printf("%s p is %s",__FUNCTION__, p);
test(p);
printf("p now is %s\r\n", p);
return;
}
void test(char *p)
{
if(p)
{
printf("p before test is %s\r\n", p);
strcpy(p, " you are man\r\n");
}
}
#include <stdio.h>
#include <string.h>
#include <memory.h>
void main()
{
char * p = malloc(100);
memset(p, 0, 100);
strcpy(p, "i love bj");
printf("%s p is %s",__FUNCTION__, p);
test(p);
printf("p now is %s\r\n", p);
return;
}
void test(char *p)
{
if(p)
{
printf("p before test is %s\r\n", p);
strcpy(p, " you are man\r\n");
}
}