【待解决】一些待解决的难题

这里记录一些待解决的程序难题

1.

1.这两种内存分配的方式,有什么不一样,
2.初始化的s最后结果有什么不一样

1
2
3
4
5
6
7
8
9
10
11
12
13
int main()
{
struct a {
int id;
string s;
};
a *ptr1 = new a();
ptr1->s = "hello";
a *ptr2 = (a*)malloc(sizeof(a));
ptr2->s = "hello";//这一句却会报异常,为什么?
system("pause");
return 0;
}

2.

List容器中empty()判空和size()==0判空有什么不同

3.

为什么函数外的指针的值没有变化

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
void getmemory(char *p)
{
p = new char[100];
strcpy_s(p,12, "hello world");
printf("%s\n", p);
return;
}
int main()
{
char *p = NULL;
getmemory(p);
printf("%s\n", p);
system("pause");
return 0;
}

而下面代码却可以改变

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
void getmemory(char **p)
{
*p = (char*)malloc(100);
strcpy_s(*p, 12,"hello world");
printf("%s\n", *p);
return;
}
int main()
{
char *p = NULL;
getmemory(&p);
printf("%s\n", p);
system("pause");
return 0;
}

4.

UE4热加载

5.

UE4 delegate,UScriptStruct,UProperty

6.

寻路算法


本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!