一 下面这段代码会不会出错,有没有问题
int n = 0;
BOOL *p = new(BOOL[n]);
delete p;
二
What is a COM object? How is it represented in C++?
三
List the four types of casts in C++. What are the differences between them, and how are they used?
四
Is the following legal C++? Why or why not?
char *p = “Hello”;
int n = 0;
BOOL *p = new(BOOL[n]);
delete p;
二
What is a COM object? How is it represented in C++?
三
List the four types of casts in C++. What are the differences between them, and how are they used?
四
Is the following legal C++? Why or why not?
char *p = “Hello”;
(*p)附值。不然会产生意想不到的结果,因为你不知道你修改的到底是谁占用的地址空间。而且你给(*P)
附值后再delete p;程序会报错。第四个问题VC中认为是合法的。可以使用
2.COM 组件对象模型
3.reinterept_cast,static_cast,dynamic_cast,const_cast
4.char *p = “Hello”;//不能这样用,Hello存放在静态存储区
Is the following legal C++? Why or why not?
char *p = “Hello”;In my opnion ,It's legal.
明显可以嘛,c/c++ 不是本来就是那么使用的吗?
和 char p[]="Hello" 没什么区别吧。