Help concatenating two items

Here is my code:

void loop()
{
  char keypressed = myKeypad.getKey();
  char keys[50];
  
  if (keypressed != NO_KEY)
  {
    Serial.print(keypressed);

    strcat(keys, keypressed);
    Serial.print(keys);
  }
}

When I run this though, I get this error:

c:\program files (x86)\arduino\hardware\tools\avr\avr\include\string.h:248:14: note: initializing argument 2 of 'char* strcat(char*, const char*)'

 extern char *strcat(char *, const char *);

As I am new to this, I am learning. :slight_smile:

In referring to this: http://www.cplusplus.com/reference/cstring/strcat/, I see you are right. Coming from a higher-level language like Java, I am having trouble understanding pointers. I read somewhere they are only used when necessary, and you can't use regular objects (like String or int), if that makes sense?
My confusion is, why does this take a pointer and a string? Why not two of the same kind?

I got it working, but have made an addition that is not working:

void loop()
{
  char keypressed = myKeypad.getKey();
  char keys[50];
  int numChars = 0;
  
  if (keypressed != NO_KEY)
  {
    Serial.print(keypressed);
    keys[numChars] = keypressed;
    numChars++;
    [b]if (keypressed == '#') {
      Serial.print(keys[2]);
    }[/b]
  }
}

When I type in 3+ characters, and hit '#', I get no output.