SDL_TTF how to render a variable

Hello, I was wondering, using SDL_TTF, how can I render a changing variable? I have tried a couple of things, but they have not seemed to work out. The text is not being rendered at all. Any help would be greatly appreciated.

Code :
auto surface = IMG_Load(“Tetris.png”);
SDL_Surface* textSurface = NULL;
TTF_Font* font = TTF_OpenFont(“PixelGameFont.ttf”, 32);
SDL_Color textColour = { 0xff, 0xff, 0xff, 0xff };
SDL_Texture *texture = SDL_CreateTextureFromSurface(renderer, surface);
//SDL_Texture *texture2 = SDL_CreateTextureFromSurface(renderer, surface2);
//SDL_FreeSurface(surface2);
SDL_Rect rect{ 425, 150, 200, 100 };
//SDL_Rect rect2{ 600, 600, 100, 100 };
//sets the screen colour to black
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0xff);
SDL_RenderClear(renderer);
//Draws the map (See “Well.cpp” for more details
well_.draw(renderer);
//Draws the tetromino (See “Tetromino.cpp” for more details
tetromino_.draw(renderer);
//SDL_RenderCopy(renderer, texture2, nullptr, &rect2);
//if statement that moves the tetromino downwards every second
if (SDL_GetTicks() > moveTime_) {
moveTime_ += 1000;
Tetromino t = tetromino_;
t.move(0, 1);
check(t);
if (well_.score != well_.oldScore) {
SDL_FreeSurface(textSurface);
std::string text = "SCORE: " + Game::IntToString(well_.score);
textSurface = TTF_RenderText_Solid(font, text.c_str(), textColour);

	}
}
SDL_Surface* screen = NULL;
//present renderer
SDL_Rect textRect{ 600, 600, 200, 50 };
SDL_BlitSurface(textSurface, NULL, screen, &textRect);
SDL_RenderCopy(renderer, texture, nullptr, &rect);
SDL_FreeSurface(surface);
SDL_RenderPresent(renderer);

//Function ‘IntToString’
std::string Game::IntToString(int score) {
std::stringstream sstream;
sstream << score;
return sstream.str();
}

//The entire top half is all under one function, however the rest of the function is unrelated to the topic, and as such I have not included it.

It was a long time ago since I rendered graphics with SDL surfaces (with SDL_BlitSurface()), so I can’t really tell what the problem is with your code.
Instead of learning it again- and then showing you how to render text with an SDL_Surface, I will instead show you how to render text/a variable with a TTF_Font and an SDL_Texture combination.
This is what you should use actually, since SDL textures are hardware accelerated and SDL surfaces are not.

Code example
void Render()
{
	SDL_RenderClear(pRenderer);

	const std::string	Result	= "My variable: " + std::to_string(Score);
	const SDL_Color		Color	= {0, 0, 0, 255};

	SDL_Surface* pSurface = TTF_RenderText_Solid(pFont, Result.c_str(), Color);

	if(pSurface)
	{
		SDL_Texture* pTexture = SDL_CreateTextureFromSurface(pRenderer, pSurface);

		if(pTexture)
		{
			int TextureWidth	= 0;
			int TextureHeight	= 0;

			SDL_QueryTexture(pTexture, nullptr, nullptr, &TextureWidth, &TextureHeight);

			const SDL_Rect Quad = {5, 5, TextureWidth, TextureHeight};

			SDL_RenderCopy(pRenderer, pTexture, nullptr, &Quad);

			// Destroy the SDL_Texture to avoid a memory leak
			SDL_DestroyTexture(pTexture);
			pTexture = nullptr;
		}

		// Destroy the SDL_Surface to avoid a memory leak
		SDL_FreeSurface(pSurface);
		pSurface = nullptr;
	}

	SDL_RenderPresent(pRenderer);
}

Thank you for the help. Your code works very well and thank you for sharing it with me.