1int* a = NULL; // Pointer to int, initialize to nothing.
2int n; // Size needed for array
3cin >> n; // Read in the size
4a = new int[n]; // Allocate n ints and save ptr in a.
5for (int i=0; i<n; i++) {
6 a[i] = 0; // Initialize all elements to zero.
7}
8. . . // Use a as a normal array
9delete [] a; // When done, free memory pointed to by a.
10a = NULL; // Clear a to prevent using invalid memory reference.
11
1int nums[100] = {0}; // initiallize all values to 0
2
3int nums[5] = {1,2,3,4,5};
4
5// type name[size] = {values};