Comparing WiFi.SSID() to char array - pointer issue?

Hello,

I am trying to compare the results of WiFi.SSID against a known SSID (in the form of a char array) to determine whether a certain network is within range. Even though both read exactly the same when I print via the serial monitor, my comparison logic always returns false. I have come to believe that this may be caused by the fact that WiFi.SSID returns a char* and not a string as the documentation states since when I try to write the result of the call to an existing char array, I get "error: incompatible types in assignment of 'char*' to 'char [20]'". Pointers are definitely not my strong suit - can anyone help me get this comparison to work correctly?

This is the code that never returns found, even though it prints out the SSID in question.

  byte num = WiFi.scanNetworks();
  boolean found = false;
  char ssid[] = "mySSID";
  Serial.println(ssid);
  for (byte i = 0; i < num; i++) {
    Serial.println(WiFi.SSID(i));           
    if (WiFi.SSID(i) == ssid) {
      found = true;
      Serial.println("Found");
    }
  }

From WiFi.h:

    char* SSID();

From your code:

  char ssid[] = "mySSID";

The comparison:

    if (WiFi.SSID(i) == ssid) {

Pointers are never going to be the same. You need to use strcmp() to compare the strings that they point to.

I knew that the two data types were different, but not how to compare them. strcmp() worked like a charm, thanks!

I knew that the two data types were different

But they aren't. An array is really nothing more than the address of the first element. And, that's all a pointer is.