static T*** Make3DArrayCont(int n, int m, int k) 什么意思
时间: 2023-12-14 17:03:45 浏览: 29
这是一个函数声明,名为 `Make3DArrayCont`。它接受三个整数参数 `n`、`m` 和 `k`,并返回一个指向 `T***` 类型的指针。
函数的目的是创建一个连续分配的三维数组,并将其指针作为返回值。`n`、`m` 和 `k` 参数分别代表数组的维度大小。函数会在内存中分配足够的空间来存储这个三维数组,并返回指向该数组的指针。
请注意,函数声明中的 `T` 是一个占位符类型,具体的类型将在实际使用时确定。例如,如果你调用 `Make3DArrayCont(2, 3, 4)` 并指定类型为 `int`,则函数将返回一个指向 `int***` 类型的指针。
相关问题
annot make a static reference to the non-static method set(int) from the type Animal
这个错误通常出现在你试图在静态上下文中调用一个非静态方法。静态方法是属于类的,而不是属于特定对象的。非静态方法则需要一个对象来调用它们。
解决这个问题的方法是创建一个 Animal 对象并调用它的 set 方法。例如:
```java
Animal animal = new Animal();
animal.set(10);
```
或者,你也可以将 set 方法改为静态方法,这样就可以直接通过类名调用它。例如:
```java
public static void set(int value) {
// code here
}
```
Cannot make a static reference to the non-static method printArray(int[]) from the type MyArrays
这个错误提示意味着你正在尝试从静态方法中访问非静态方法 `printArray(int[])`。因为静态方法不依赖于类的实例,因此它们只能访问类的静态成员,而不能访问类的非静态成员。要解决这个问题,你需要将 `printArray(int[])` 方法标记为静态方法,或者通过创建类的实例来调用它。以下是两种可能的解决方案:
1. 将 `printArray(int[])` 方法标记为静态方法:
```java
public class MyArrays {
public static void printArray(int[] arr) {
// 方法体
}
}
```
2. 通过创建类的实例来调用 `printArray(int[])` 方法:
```java
public class MyArrays {
public void printArray(int[] arr) {
// 方法体
}
}
public class Main {
public static void main(String[] args) {
MyArrays myArrays = new MyArrays();
int[] arr = {1, 2, 3};
myArrays.printArray(arr);
}
}
```
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![7z](https://img-home.csdnimg.cn/images/20210720083312.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)