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_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);
//Draws the map (See “Well.cpp” for more details
//Draws the tetromino (See “Tetromino.cpp” for more details
//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);
if (well_.score != well_.oldScore) {
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);

//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()

	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);

		SDL_Texture* pTexture = SDL_CreateTextureFromSurface(pRenderer, pSurface);

			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
			pTexture = nullptr;

		// Destroy the SDL_Surface to avoid a memory leak
		pSurface = nullptr;


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