simple task, to generate arrays with length I want to.
I don't also know how to get array I've created, except my own weird method. Does the first part of my code work alright and I should reconsider the way I want to get them (optional)?
although, I do understand why do I get the same values each time, but I don't think, it's related to my problem somehow.
I'm writing down this:
  cin >> x;
  int array1[x];
  int array2[x]; 
  for (int i = 0; i <= x; i++) {
    array1[i] = rand() % 10 + 1;
    array2[i] = rand() % 10 + 1;
  }
  
  cout << "[" << array1[a];
  for (int a = 0; a <= x; a++) {
    a += 1; 
    cout << ", " <<array1[a];
  }
  cout << "] [" << array2[b];
  for (int b = 0; b <= x; b++) {
    b += 1; 
    cout << ", " << array2[b];
  }
  cout << "]";
why do i get some abnormal answer for x = 6, 5, 15 cases like this:
[2, 5, 9, 6, 0] [8, 1, 9, 6, 32759]
[2, 5, 9, 6, 2, 8, 3, 2, 8] [8, 1, 9, 6, 2, 7, 4, 7, 7]
 
    