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

Latest commit

 

History

History
19 lines (15 loc) · 522 Bytes

at.md

File metadata and controls

19 lines (15 loc) · 522 Bytes

at

Description :

  • Returns a reference to the element at position n in the vector.

  • If the position is not present in the vector, it throws exception of type out_of_range

Example:

	// Create a vector of 5 integers  
	std::vector<int> myVector{1, 2, 3, 4, 5};

	// Display the contents of vector using std::vector::at.
	for (int i = 0; i < 5; i  ) {
	    std::cout << myVector.at(i) << " ";
	}

See Sample code Run Code