这是一个人为的例子,但请考虑以下几点:
#include <iostream>
#include "gsl.h"
int main(){
//object or array that I'd like to iterate over one byte at a time
char array[] = {'a','b','c','d','e','f'};
//create a C-like iterator
char* it = &ar
我有一个c函数接收数组指针作为它的一个参数。
因为pass数组实际上是其第一个元素的指针,所以数组的指针应该是指针的指针。
int arr[]={0,1,2,3};
int main(){
receiveArray(arr);
receiveArrayPtr(&arr);
}
int receiveArray(int *arrPara){....}
int receiveArrayPtr(int **arrPtrPara){....} //Why cannot do this?
错误信息是
“预期‘int**’但参数类型为‘int()4’
无效receiveArray
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main()
{
int x[][2] = { {1,2},{3,4},{5,6},{7,8} };
int i, j;
printf("%d \n", x);
for (i = 0; i <= 3; i++)
{
printf("%u %u\n", x + i, *(x + i));
}
for (i = 0; i <= 3; i++)
{