looping through repeated items of array with only one for

Status
Not open for further replies.

ahmedsaber

Junior Member level 1
Joined
Mar 11, 2013
Messages
19
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Al Jizah, Egypt
Activity points
1,449
hi all , in C :

if i have an array contains repeated scattered items , and i need to make this array has no repeated elements but i ,must use only one for loop , how can i do this ?
 

You need to compare each item with all the other items. It requires nesting a for loop inside another.

- - - Updated - - -

---------------------------

The only way you could do it with a single for loop, is if there is a one-line command in C which automatically compares all items in an array.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…