while
#include <iostream>
using namespace std;
int main() {
int arr[6] = { 0 };
int* ptr = arr;
int len = sizeof(arr) / sizeof(int);
for (int i = 0; i < len; i++) {
cin >> arr[i];
}
// write your code here......
while (*ptr != NULL) {
cout << *ptr << " ";
ptr++;
}
return 0;
}
for
#include <iostream>
using namespace std;
int main() {
int arr[6] = { 0 };
int* ptr = arr;
int len = sizeof(arr) / sizeof(int);
for (int i = 0; i < len; i++) {
cin >> arr[i];
}
// write your code here......
for (int i=0; i<len; i++) {
cout << *ptr << " ";
ptr++;
}
return 0;
}