list push_back() function in C++ STL Last Updated : 30 May, 2023 Comments Improve Suggest changes Like Article Like Report The list:push_back() function in C++ STL is used to add a new element to an existing list container. It takes the element to be added as a parameter and adds it to the list container. Syntaxlist_name.push_back(value)ParametersThis function accepts a single parameter which is a mandatory value. This refers to the elements needed to be added to the list, list_name.Return ValueThe return type of this function is void and it does not return any value.Example The below program illustrates the list::push_back() function. CPP // CPP program to illustrate the // list::push_back() function #include <bits/stdc++.h> using namespace std; int main() { // Initialization of list list<int> demo_list; // initial size of list cout << "Initial Size of the list: " << demo_list.size() << endl; // Adding elements to the list // using push_back function demo_list.push_back(10); demo_list.push_back(20); demo_list.push_back(30); // Size of list after adding // some elements cout << "Size of list after adding three " << "elements: " << demo_list.size(); return 0; } OutputInitial Size of the list: 0 Size of list after adding three elements: 3 Time Complexity: O(1)Auxiliary Space: O(1) Comment More infoAdvertise with us B barykrg Follow Improve Article Tags : Misc C++ STL CPP-Functions Explore Introduction to C++Introduction to C++ Programming Language3 min readHeader Files in C++5 min readSetting up C++ Development Environment8 min readDifference between C and C++3 min readBasicsC++ Data Types7 min readC++ Variables4 min readOperators in C++9 min readBasic Input / Output in C++5 min readControl flow statements in Programming15+ min readC++ Loops7 min readFunctions in C++8 min readC++ Arrays8 min readStrings in C++5 min readCore ConceptsPointers and References in C++5 min readnew and delete Operators in C++ For Dynamic Memory5 min readTemplates in C++8 min readStructures, Unions and Enumerations in C++3 min readException Handling in C++11 min readFile Handling through C++ Classes8 min readMultithreading in C++8 min readNamespace in C++5 min readC++ OOPInheritance in C++10 min readC++ Polymorphism5 min readEncapsulation in C++4 min readAbstraction in C++4 min readStandard Template Library(STL)Containers in C++ STL3 min readIterators in C++ STL10 min readC++ STL Algorithm Library2 min readPractice C++C++ Interview Questions and Answers (2025)15+ min readTop C++ DSA Related ProblemsC++ Programming Examples7 min read Like