char array problems

Dears if i want to save some date at code[10]="abcdef1234" and i want to store it in another array bigone[200] then compare the code1[10] with the bigone[200] if it exist how can i deal with this i have problem with array Thanks in advance

I'm not sure I fully understand what you're trying to do. From your description, it seems that you wish to compare the contents of the code[] array with the contents of bigone[] to see if code[] appears in bigone[]. If that's the case, there are a ton of algorithms from which to choose, ranging from simple "brute force" to Boyer-Moore and many in between. If you are using string data, the standard library function strstr() might work. However, since you defined code[] with only 10 elements and you have 10 characters in it, it is not a string because the null termination character ('\0') is missing. Perhaps you can clarify your needs a little more?

thanks for your reply i want to store the code that 10 char to bigcode char that have 200 char and every time i store the new code[10] to next ten location in bigcode then i want to compare any ten char in code[10] with the array bigcode if exist or not

A bit like strstr?

need to compare the code[10] with bigcode[100] is exists in it

need to store the code[10] in bigcode[100]

just like that

So, very like strstr.

just like that

You're tap-dancing is fancy, but useless. WHERE in bigcode do you want to store code? What have you tried?

i need to store code[10] in first 10 location in bigcode (i can say 1-10) then new code[10] will store in next 10 location in bigcode (11-20) and so on

If bigcode is simply a container for unique ten-character values, you might find it's easier to access it as a two dimensional array. If you really want to store it as one big string then you can just keep adding 10 to your bigcode array index to get to the start of the next block of ten characters.

Perhaps this would make more sense if we had some idea what these ten-character codes are, and why you're assembling a 100-character array from them.

You probably can do what you need using the String functions. Below is simple code that looks for a character String within a character string sent from the serial monitor.

// zoomkat 7-30-11 serial I/O string test
// type a string in serial monitor. then send or enter
// for IDE 0019 and later

String readString;

void setup() {
  Serial.println("serial test 0021"); // so I can keep track of what is loaded

void loop() {

  while (Serial.available()) {
    delay(2);  //delay to allow byte to arrive in input buffer
    char c =;
    readString += c;

  if (readString.length() >0) {
    Serial.println(readString); //prints string to serial port out

    if(readString.indexOf("woohoo") >=0) {
      Serial.println("I found woohoo!"); 

You need an array with eleven elements, to store a ten character "string". Because the last position in the array should contain a 0x00

Dear kindly any help suppose that code[10]=abcdafdes and bigcode[200]= asd111111 abcdafdes 123345was etc need code to compare code with bigcode if code exist in bigcode

Have you considered using strstr? (Assuming both are C strings)

how to use it strstr ? need help


A for loop and an if statement are one way of doing it - what have you tryed show us your code!


hi i try some codes but not work can i compare data in arduino matrix1(10) with matrix2(200)

Thanks in advanced

i try some codes but

...I'm not going to show you any of them.

i have problems with array (matrix) why you Harness

Whatever method you're using to translate that into English isn't working.