You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
442 B
27 lines
442 B
/*
|
|
看代码有没有错误或隐患
|
|
*/
|
|
|
|
|
|
#include<stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
void get2(char *p){
|
|
// char *aa;
|
|
// memcpy(aa, "bbb", 3);
|
|
// p = aa;
|
|
// p = (char *)malloc(10);
|
|
*p = 'c';
|
|
}
|
|
int main(){
|
|
char *m;
|
|
memcpy(m, "aaa", 3);
|
|
get2(m);
|
|
|
|
for(int i = 0; i < 300; i++){
|
|
char tmp = *(m + i);
|
|
if(tmp == '\0')break;
|
|
printf("%c", *(m + i));
|
|
}
|
|
return 0;
|
|
}
|