Skip to content

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