Skip to content

Exercise2.23 there might be a mistake here #47

Open
@Zhangxh251

Description

@Zhangxh251

原题:给定指针 p,你能知道它是否指向了一个合法的对象吗?如果能,叙述判断的思路;如果不能,也请说明原因。

我的看法: 把 if(p) 放在 try 中 , 当程序块顺利执行时,表示p指向了合法的对象;当程序块出错跳转到catch语句时,表示p没有指向合法的对象。

答案思路来源- 牛客网
https://m.nowcoder.com/questionTerminal?uuid=3c218c5306324eaf9de45a74932f0b9e

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions