title: SDL_Log outputting ??" when trying to output a string
body: <p>I've been trying to send a log in the console to make sure the player was created, but here is the results:</p>
  
  <p><a href="https://i.stack.imgur.com/A8adO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/A8adO.png" alt="Console Outputs"></a>
  <br></p>
  
  <p>Here is the code along the problematic part:</p>
  
  <pre><code>SDL_Log("%s has %i hp out of %i", player1.name, player1.health, player1.maxhealth);
  </code></pre>
  
  <p>systemValues.h:</p>
  
  <pre><code>// Core Libraries and Headers
  // - Global includes
  #include &lt;SDL.h&gt;
  #include &lt;SDL_image.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;string&gt;
  #include &lt;typeinfo&gt;
  
  // Defines
  #define GRAPHICS "../resources/"
  
  struct Player
  {
    std::string sprite;
    std::string name;
    int level;
    int size;
    int health;
    int maxhealth;
    int magicpower; // Magic Points
    int damages;
    int armor;
    int magic;
  };
  
  struct Enemy
  {
    std::string sprite;
    std::string name;
    int level;
    int size;
    int health;
    int maxhealth;
    int magicpower; // Magic Points
    int damages;
    int armor;
    int magic;
  };
  
  Player createPlayer(std::string name);
  Enemy createEnemy(std::string name, int level);
  
  int damagePlayer(Player target, int damages);
  int damageEnemy(Enemy target, int damages);
  
  void close();
  </code></pre>
  
  <p>main.cpp:</p>
  
  <pre><code>// Local includes
  // - Custom Headers
  #include "systemValues.h"
  
  // Screen constants and dimensions. (TODO: MOVE TO A PROPER HEADER FILE.)
  const int SCREEN_WIDTH = 640;
  const int SCREEN_HEIGHT = 480;
  
  // The window that is rendered to
  SDL_Window* window = NULL;
  
  // Quit being false means the application is running and did not request to quit
  bool quit = false;
  
  // Event handler
  SDL_Event e;
  
  // The surface contained by the window
  SDL_Surface* screenSurface = NULL;
  
  // Main function
  int main(int argc, char* args[])
  {
  
    // Initializing SDL
    if (SDL_Init(SDL_INIT_VIDEO)&lt;0)
    {
      SDL_Log("SDL could not initialize! SDL_Error: %s\n", SDL_GetError());
    }
    else
    {
      // Creating the window
      window = SDL_CreateWindow("SDL Tutorial", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN);
      if (window == NULL)
      {
        SDL_Log("The window could not be created! SDL_Error: %s\n", SDL_GetError());
      }
      else
      {
  
        Player player1 = createPlayer("Avarthar");
        Enemy enemy1 = createEnemy("Blob", 1);
  
        // Get the window surface
        screenSurface = SDL_GetWindowSurface(window);
  
        // While the application is running
        while (!quit){
          while (SDL_PollEvent(&amp;e) != 0)
          {
            // User requests quit
            if (e.type == SDL_QUIT)
            {
              quit = true;
            }
            // Checks for a key being pressed down
            else if (e.type == SDL_KEYDOWN)
            {
              switch(e.key.keysym.sym)
              {
                // Checks if the key is F
                case SDLK_f:
                  player1.health = damagePlayer(player1, 5);
                  SDL_Log("%s has %i hp out of %i", player1.name, player1.health, player1.maxhealth); // TODO - Remove the test line
                  break;
                case SDLK_ESCAPE:
                  quit = true;
                  break;
              }
            }
          }
  
          // Test if player is created
          if (player1.name == "Avarthar")
          {
            SDL_FillRect(screenSurface, NULL, SDL_MapRGB(screenSurface-&gt;format, (player1.health*-1+100*2), player1.health*2, 0));
          }
          else
          {
            SDL_FillRect(screenSurface, NULL, SDL_MapRGB(screenSurface-&gt;format, 255, 255, 255));
          }
          // Update the surface
          SDL_UpdateWindowSurface(window);
        }
      }
    }
  
    close();
  
    // Return 0 to terminate the program
    return 0;
  }
  
  // Creates a player with the given varables 
  Player createPlayer(std::string name)
  {
    Player player;
    player.sprite = "";
    player.name = name;
    player.level = 1;
    player.size = 32;
    player.health = 100;
    player.maxhealth = 100;
    player.magicpower = 100;
    player.damages = 1;
    player.armor = 0;
    player.magic = 1;
  
    return player;
  }
  
  Enemy createEnemy(std::string name, int level)
  {
    Enemy enemy;
    enemy.sprite = "";
    enemy.name = name;
    enemy.level = level;
    enemy.size = 32;
    enemy.health = 100;
    enemy.maxhealth = 100;
    enemy.magicpower = 100; // Magic Points
    enemy.damages = 1;
    enemy.armor = 0;
    enemy.magic = 1;
  
    return enemy;
  }
  
  // Deals damage to the target of type Player
  int damagePlayer(Player target, int damages)
  {
    target.health -= damages;
  
    // Checks whether the target is in the health range or not
    if (target.health &lt; 0)
      target.health = 0;
    if (target.health &gt; target.maxhealth)
      target.health = target.maxhealth;
  
    return target.health;
  }
  
  // Deals damage to the target of type Enemy
  int damageEnemy(Enemy target, int damages)
  {
    target.health -= damages;
  
    // Checks whether the target is in the health range or not
    if (target.health &lt; 0)
      target.health = 0;
    if (target.health &gt; target.maxhealth)
      target.health = target.maxhealth;
  
    return target.health;
  }
  
  void close()
  {
    // Wait 0.1 seconds
    SDL_Delay(100);
  
    // Clear the window from the memory
    SDL_DestroyWindow(window);
  
    // Quit the SDL subsystems
    SDL_Quit();
  }
  </code></pre>
  
  <p>What I tried so far:</p>
  
  <ul>
  <li>I tried with <code>&amp;player1.name</code> and it didn't change anything.</li>
  <li>I also tried with only <code>SDL_Log("%s", player1.name);</code> and it instead wrote a single <code>?</code> in the outputs.</li>
  </ul>
  
  <p>The color changing according to the <code>player1.health</code> is working without any problem, but as soon as I try getting and sending the name in the <code>SDL_Log</code> it sends the outputs shown in the screenshot above.</p>