Hi all, this is my first post here and it comes out of frustration more than anything. I've been searching high and low for any insight into my problem and still can't seem to get it right. In the interest of full disclosure, this is a part of a homework problem and I'm not asking for anyone to solve the problem, I just need some help with this part. We're playing around with STL containers and algorithms and I need to copy an array of random characters into a vector using the copy() algorithm. As I understand I'm going to need a pointer to the beginning of the array and a pointer to the end of the array. So I have my array called data that has 25 characters in it, then I would need to make a pointer to the beginning char* dataBegin = &data[0] and to the end char* dataEnd = &data[24]. Then I used those in the copy algorithm by typing - copy(dataBegin, dataEnd, charVector.begin()) - where charVector is the vector I'm trying to copy into. Everything I've read says thats the proper format the copy algorithm but when I compile and run, it seg faults every time. Does anything that I've put jump out as an error I've made? Thanks for the help.
TuX4020 0 Newbie Poster
Narue 5,707 Bad Cop Team Colleague
TuX4020 0 Newbie Poster
Narue 5,707 Bad Cop Team Colleague
TuX4020 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.