Why index line is not working and how it works

hi @Rajan_42 list is not stored in contigous memory locations so itr-l.begin() will not give you the index. This works perfectly fine if you use a vector instead because vectors have contigous memory locations for all the elements. See the code for vector here https://ide.codingblocks.com/s/294788