Storing data from string to 2D array

hello,i want to store data getting from ble scan i.e.storing_data1.length() and add it to 2D array.....

i write function like n = storing_data1.length();
char char_array[20][70]; // declaring character array
strcpy(char_array[n], storing_data1.c_str()); // copying the contents of the string to char array

      for (int i = 0; i < n; i++)
       {
         for (int j = 0; j < n; j++)
       {
          myArray[nr][nc] = myArray[nr][nc]++;
          Serial.print(char_array[i][j]);
        }
         Serial.print(char_array[i][j]);
        }   

can anyone please help mw out i am new at this platform........thank you

something like this you mean?

void setup() {
  // put your setup code here, to run once:
  char char_array[10][10]; // declaring character array

  Serial.begin(115200);


  for (int i = 0; i < 10; ++i) {
    //dummy data from ble scan ;)
    String str = "String #";
    str += String(i + 1, DEC);
    //

    memcpy(&char_array[i][0], str.c_str(), str.length() + 1); //store data from string to 2D array
  }

  for (int j = 0; j < 10; ++j) {
    Serial.println(char_array[j]); //print out 2D array
  }

}

void loop() {
  // put your main code here, to run repeatedly:

}

Output:

String #1
String #2
String #3
String #4
String #5
String #6
String #7
String #8
String #9
String #10

be sure to check that your board has sufficient memory for the array size you want to use or the code will fail!

hope that helps....

just use an array of Strings then in place in a char 2D array and do storing_data1.c_str() conversion as and when you require to do so


@sherzaad when i refer code suggest by you i am getting output like in screenshot data get overlapped not get append......please suggest me something....
thank you....

Can you please post the code which is doing the scanning. Thanks.

please post the code you trialled...

post your FULL code or at LEAST one that compiles!

not snippets!

I have no idea what ur doing!!!!

your FOR loop

for (int i = 0; i < 10; ++i)

your WHILE loop

while(i>=31)

notice anything there....?

also as pointed out previously, just use an array of Strings in place of a 2D char array, or is there a reason you HAVE to use char array?

please stop spamming us with snippets!
If someone else can, good for you, but unfortunately I cannot make sense of your snippets!

AND PLEASE CONFIRM the following:

does the example code AS SHARED on reply #2 work for you??
not interested in any of your modding right now!