char* p = new char(32);释放内存的语句是:
A: delete [] p;
B: free(p)
C: delete p;
D: delete p;
A: delete [] p;
B: free(p)
C: delete p;
D: delete
A,C
举一反三
- char* p = new char(32);释放内存的语句是: A: delete &p; B: delete *p; C: delete [] p; D: delete <char> p;
- char* p = new char(32);释放内存的语句是: A: delete [] p; B: free(p) C: delete p; D: delete <char> p;
- char* p = new char[65];对应的释放内存的语句是: A: free p; B: delete *p; C: delete [] p; D: delete p[];
- 下面小段程序,哪个是正确的:() A: char * p = new char[10];p[0] = 'K'; delete [] p; B: int *p = new int[25]; p[10] = 100; delete p C: char * p = new int; p = 'a'; delete p; D: int * p = new char[20];p = 'a'; delete p;
- 中国大学MOOC: char* p = new char(32);释放内存的语句是:
内容
- 0
以下关于数组动态分配与释放内存的正确代码是 A: int p[100] = new int[100] 和 delete p B: int *p = new int(100) 和 delete p C: int *p = new int[100] 和 delete []p D: int *p = new int(100) 和 delete []p
- 1
以下语句不正确的是()。 A: char a[6]="love"; B: char a[6], *p=a;p="love"; C: char *a;a="love"; D: char a[6], *p; p=a="love";
- 2
以下语句不正确的是( )。 A: char a[6]="test"; B: char a[6],*p=a;p="test" C: char *a;a="test"; D: char a[6],*p;p=a="test";
- 3
设char str[]="OK";,对指针变量p的说明和初始化语句是( )。 A: char p=str; B: char *p=str; C: char p=&str; D: char *p=&str;
- 4
下列哪项声明的是指向函数的指针? A: char *p; B: char a,char &p=a; C: char (*p)(char *,char *); D: char *p[10];