How do I compare what is in one array with what is in another array?
coolmel55 0 Light Poster
Recommended Answers
Jump to PostLoop through all array elements and compare each element; if all elements are the same, consider the arrays equal. Or use memcmp, which essentially does this.
Jump to Post>Or use memcmp, which essentially does this.
memcmp uses a shallow byte-by-byte comparison, so depending on the type of items in the array this might not be a good idea.I know what you are saying, but would you mind listing examples.
Jump to Post>I know what you are saying, but would you mind listing examples.
The simplest example is an array of pointers. Do you want to compare the value of the pointers or the value of the addresses pointed to:#include <stdio.h> #include <string.h> int main ( void ) …
All 11 Replies
Dave Sinkula 2,398 long time no c Team Colleague
Narue 5,707 Bad Cop Team Colleague
Dave Sinkula 2,398 long time no c Team Colleague
djextazy 0 Newbie Poster
lara_ 0 Newbie Poster
Narue 5,707 Bad Cop Team Colleague
Asif_NSU commented: It's good to know there's an uncompromising critic out there-- Asif_NSU +1
lara_ 0 Newbie Poster
Narue 5,707 Bad Cop Team Colleague
djextazy 0 Newbie Poster
Dman01 10 Light Poster
arkoenig 340 Practically a Master 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.