Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Latest commit

 

History

History
23 lines (17 loc) · 580 Bytes

front.md

File metadata and controls

23 lines (17 loc) · 580 Bytes

front

Description :The vector::front() is a built-in function in C++ STL which is used to return a reference to the first element in a vector container.

Example:

    // Creating a vector 
    std::vector<int> example; 
  
    // Add elements to the List 
    example.push_back(10); 
    example.push_back(20); 
    example.push_back(30); 
    example.push_back(40); 
  
    // get the first element using front() 
    int & ele = example.front(); 
  
    // Print the first element 
    std::cout << ele; 
 

Run Code