#include <iostream>
#include <vector>
#include <string>
#include <stdlib.h>
#include <unistd.h>
#include <cstring>
int main(int argc,char** argv){
int32_t* test;
int32_t debug[4][4] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
test = (int32_t*)&debug[0][0];
for(int32_t i = 0 ; i < 16 ; i++){
std::cout << test[i] << " ";
}
return 0;
}
#include <iostream>
#include <vector>
#include <string>
#include <stdlib.h>
#include <unistd.h>
#include <cstring>
int main(int argc,char** argv){
int32_t debug[4][4] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
int32_t **ptr = (int32_t**)debug;
int32_t (*_ptr)[4] = (int32_t(*)[4])ptr;
std::cout <<_ptr[0][0] << std::endl;
std::cout <<_ptr[3][3] << std::endl;
return 0;
}
这是一个 很有意思的指针游戏 : 指针就是指针不是数组
|