下面的代码有什么问题?void DoSomeThing(...){char* p;...p = malloc(1024); // 分配1K的空间i
下面的代码有什么问题?
void DoSomeThing(...)
{
char* p;
...
p = malloc(1024); // 分配1K的空间
if (NULL == p)
return;
...
p = realloc(p, 2048); // 空间不够,重新分配到2K
if (NULL == p)
return;
...
}
下面的代码有什么问题?
void DoSomeThing(...)
{
char* p;
...
p = malloc(1024); // 分配1K的空间
if (NULL == p)
return;
...
p = realloc(p, 2048); // 空间不够,重新分配到2K
if (NULL == p)
return;
...
}
下面的代码有什么问题?
class A
{
public:
A() { p=this; }
~A() { if(p!=NULL) { delete p; p=NULL; } }
A* p;
};
以下代码有什么问题?
struct Test
{
Test(int ) {}
Test() {}
void fun() {}
};
void main(void )
{
Test a(1);
a.fun();
Test b();
53
b.fun();
}
下面代码有什么问题?
Void test3(char* str1)
{
char string[10];
if(strlen(str1)<=10)
{
strcpy(string, str1);
}
}
下面代码有什么问题?
Void test2()
{
char string[10], str1[10];
for(i=0; i<10;i++)
{
str1[i] ='a';
}
strcpy(string, str1);
}
下面的代码中有什么错误吗?_______
using System;
class A
{
public virtual void F(){
Console.WriteLine("A.F");
}
}
abstract class B:A
{
public abstract override void F();
下面的代码中有什么错误吗?_______
using System;
class A
{
public virtual void F(){
Console.WriteLine("A.F");
}
}
abstract class B:A
{
public abstract override void F();
}
12 . 下面的代码输出是什么,为什么?
void foo(void)
{ unsigned int a = 6;
int b = -20;
(a+b > 6) puts("> 6") : puts("<= 6");
}
12 . 下面的代码输出是什么,为什么?
void foo(void)
{
unsigned int a = 6;
int b = -20;
(a+b > 6) puts("> 6") : puts("<= 6");
}
public void Test() {
try {
method();
System.out.println("Hello World");
}
catch (ArrayIndexOutOfBoundsException e)
{
System.out.println("Exception?");
}
catch(Exception e)
{
System.out.println("Exception1");
}
finally{
System.out.println("Thank you!");
}
}
如果函数method正常运行并返回,会显示下面的哪些信息?()
A.Hello World
B.Exception
C.Exception1
D.Thank you!