Here is the example that how to use New and Delete operator when you use the pointer array.
The pointer array is often used to logic.
---------------------------------------------------------------------------
int *array[3]; // pointer array int type
*array=new int[3]; // get the address of 1st.
printf("*array address is %d\n",*array);
*(array+1) = new int[3]; //get the address of 2nd.
printf("*(array+1) address is %d\n",*(array+1));
*(array+2) = new int[3]; //get the address of 3th
printf("*(array+2) address is %d\n",*(array+2));
delete [] *(array);
delete [] *(array+1);
delete [] *(array+2);
----------------------------------------------------------------
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment