正在加载图片...
Dynamically Allocated Arrays The declaration item array new item[array size creates a dynamic array of Item objects, indexed from o up to array size -1. Consider, for example int size, dynamic array, i; cout < Enter an array size: < flush cIn > sIze: dynamic array new int[size] for(i=0; i<size; i++)dynamic array[i]= The result is illustrated as:The declaration item array = new Item[array size]; creates a dynamic array of Item objects, indexed from 0 up to array size - 1.Consider, for example: Dynamically Allocated Arrays int size, *dynamic_array, i; cout << "Enter an array size: " << flush; cin >> size; dynamic_array = new int[size]; for (i=0; i<size; i++) dynamic_array[i]=i; The result is illustrated as:
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有