c_cpp 将int数组传递给指针c加上

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了c_cpp 将int数组传递给指针c加上相关的知识,希望对你有一定的参考价值。

#include <iostream>


//int pointer and array practice
int main() {
	int items[10];
	//assigns int pointer to int array
	int * pnt = items;
	pnt[0] = 3;
	std::cout << pnt[0] << std::endl;
	//3
	pnt[1] = 2;
	std::cout << pnt[1] << std::endl;
	//2
}

以上是关于c_cpp 将int数组传递给指针c加上的主要内容,如果未能解决你的问题,请参考以下文章