| 12345678910111213141516171819202122232425262728 |
- #include <iostream>
- int main()
- {
- int my_array[5] = {1, 2, 3, 19, 5};
- // same 2 line
- std::cout << " Add: " << my_array << std::endl;
- std::cout << " Add: " << &my_array << std::endl;
- std::cout << "Add+3: " << my_array + 3 << std::endl;
- std::cout << *(my_array + 3) << std::endl;
- // this line below is doing exactly the same as the line above
- std::cout << my_array[4] << std::endl;
- int new_array[5];
- for (int i = 0; i < 5; i++)
- {
- std::cout << "Number: ";
- std::cin >> new_array[i];
- }
- // care the index number if using this method
- for (int i = 0; i < 6; i++)
- {
- std::cout << *(new_array + i) << std::endl;
- }
- return 0;
- }
|