gpt4 book ai didi

java - 将c++代码翻译成java

转载 作者:行者123 更新时间:2023-11-28 03:44:56 25 4
gpt4 key购买 nike

我需要将一些 C++ 翻译成 Java,但我遇到了一些问题。

当指针在方法中被声明为参数时,我该如何处理指针?

static void test( double *output){}

还有什么是以及如何替换结构?

struct test { int t;
int arg;
float *pva;
double *array;
}

然后在他们使用的代码中:

double test(struct test *test)
{}

哦,最后一个..这也在结构测试中,什么意思:

test->arg

最佳答案

static void test( double *output){}

这需要更多上下文,它可能意味着指向 double 或 double 组的指针。

struct test { int t;
int arg;
float *pva;
double *array;
}

struct 是具有默认public 访问级别的。您可以将其替换为具有 public 成员的类。

test->arg

这将访问 test 中的 arg 成员。

关于java - 将c++代码翻译成java,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7951808/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com