Get to know with arrays
การแสดงค่าที่อาเรย์เก็บไว้ทั้งหมดตามลำดับ
int arr[] = {11,4,2,77,112,69,420,13};
int n = *(&arr + 1) - arr; //find length of array
for (int i=0;i<n;i++){
cout<<arr[i]<<" "; // print untill the end of array
}การรับค่าใส่อาเรย์ทั้งหมดตามลำดับ
int arr[8];
int n = *(&arr + 1) - arr; //find length of array
for (int i=0;i<n;i++){
cout<<"Please enter integer : ";
cin >> arr[i]; // enter untill the end of array
}การสร้างฟังค์ชั่นเพื่อรับอาร์เรย์
Last updated
Was this helpful?