String Pop Back Function - C++ Programming Tutorial
C++ Course / Strings / String Pop Back Function

String Pop Back Function

BLUF: Mastering String Pop Back Function is a critical step in becoming a proficient C++ developer. This lesson provides a deep dive into the syntax, performance considerations, and real-world applications of this concept.
Key Performance Insight: String Pop Back Function

C++ is renowned for its efficiency. Learn how String Pop Back Function enables low-level control and high-performance computing in the tutorial below.

C++ String pop_back

This function serves to eliminate the final character from a string, thereby reducing its length by one.

Syntax

Consider a string str. Syntax would be :

Example

str.pop_back();

Parameters

This function does not contain any parameter.

Return value

This function does not return any value.

Example 1

Let's see the simple example.

Example

#include<iostream>
using namespace std;
int main()
{
string str ="javac";
str.pop_back();
cout<<str;
return 0;
}

Output:

Input Required

This code uses input(). Please provide values below:

Logic Practice
Install Logic Practice
Add to home screen for a faster app-like experience