1 / 12

C Vectors Tutorial | Vectors In C | C Vector Example | C Programming Tut

A C vector is an array-like container, but unlike arrays, its size can change dynamically. In this video, we will learn Why we use vectors in C , What is a vector in C along with its syntax. After that, we will understand member functions of C vector with the help of some hands-on examples. <br><br>1. Why we use vectors in C <br>2.u200b What is a vector in C <br>3. Syntax<br>4. Member functions of C <br>5. Modifiers<br>6.u200b Iterators<br>7.u200b Capacity<br><br>Learn more: https://www.simplilearn.com/c-plus-plus-programming-for-beginners-article<br>

Simplilearn
Download Presentation

C Vectors Tutorial | Vectors In C | C Vector Example | C Programming Tut

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. What’s in it for you? Why we use vectors in C++? What is vector in C++? Syntax Member function of vectors Modifiers Iterators Capacity

  2. Why we use vectors in C++ ? Vectors are used in C++ because unlike arrays it’s size can be changed during runtime It has some extra inbuilt features like push_back() , size() , empty() etc

  3. Click here to watch the video

  4. What is vector in C++ ? It is not necessary to mention the size of vector while declaring it A vector is array like container, just like array it uses contiguous memory locations. But unlike array it’s size can change dynamically

  5. Syntax vector<int>v1 vector<string>v2 vector<float>v3 Here, v1 ,v2, v3 are variable names

  6. Member functions of vectors Modifiers 2. Iterators 3. Capacity

  7. Modifiers It adds element at the end • push_back() • clear() It deletes the last element • erase() Inserts new elements before specified position Removes the elements from the container from the specified range It swaps the content between vectors • pop_back() • swap() It assigns new value to the vector It is used to remove all elements assign() insert()

  8. Iterators begin() It returns the iterator to the beginning end() It returns the iterator to the end

  9. Capacity size() It returns number of elements in the vector resize() empty() It changes the size It tests whether the vector is empty max_size() It returns maximum size of vector capacity() Returns size of allocated storage capacity

More Related