Does anyone know how to create circular linked list whose links are numbered from 1 to n specified by the user?
cblue 0 Newbie Poster
Recommended Answers
Jump to Postvoid FillMyArray(int ArrayToBeFilled[], int TopValueToBeInserted) { for(int i = 1; i<=TopValueToBeInserted;i++) { ArrayToBeFilled[i] = i; } }
The usual (and correct) idiom is like this.
for(int i = 0; i < TopValueToBeInserted; i++)
An array of size N is indexed from 0 to N-1.
Jump to PostOr using the usual idiom,
for ( int i = 0; i < TopValueToBeInserted; i++ ) { ArrayToBeFilled[i] = i + 1; }
Jump to PostApparently you don't trust the people you ask questions to. Otherwise you wouldn't post the same question on multiple sites. That's a pet peeve of mine, so if you're going to post identical threads and identical replies, at least include what you've been shown in your identical thread on the …
All 10 Replies
marinme 0 Junior Poster in Training
cblue 0 Newbie Poster
marinme 0 Junior Poster in Training
Dave Sinkula 2,398 long time no c Team Colleague
marinme 0 Junior Poster in Training
Dave Sinkula 2,398 long time no c Team Colleague
marinme 0 Junior Poster in Training
cblue 0 Newbie Poster
Narue 5,707 Bad Cop Team Colleague
jai verma -4 Newbie Poster
Salem commented: You should have saved yourself the hassle of joining, if that's the best you can do -4
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.