Random-access structures in C++?
Is an array, sequential list, and linked list random-access structures in C++?
I know random-access means that you can access the elements stored in the structures randomly (go from 0 to 3 to 5 to 2...) but I'm not sure about these. I don't an array or sequential list is random-access but I think linked lists might be. Am I right? Can you explain why if I'm wrong?
- Unca AlbyLv 79 years agoFavorite Answer
Random access in this case means you can pick where you want to access the data. It's not "random" like rolling the dice or anything.
An array would be random-access because, if you want the 14th element in the array, you just specify  in the array specifier and, "boom" there it is.
A linked list is not random-access because if you want a given piece of data, you need to traverse the nodes of the list until you get to it. If you want the 14th element you have to start at the first, move to the second, then the third, etc. until you get to the 14th.
- James BondLv 79 years ago
file also can be accessed randomly
- ?Lv 44 years ago
Why do you call it randList in one section and chunkslist in yet another section? printf %s is finding for a null terminated character string, which potential if chunkslist is a char** that has been good allotted and initialize than **chunkslist factors to a char. you ought to use %c for that, no longer %s