Don't ad-block us - support your favorite websites. We have safe, unobstrusive, robotics related ads that you actually want to see - see here for more.
0 Members and 1 Guest are viewing this topic.
bool CompareArrays() { for(int x = 0; x < 10; x++) { if(array1[x] != array2[x]) { return false; } } return true;}void main() { if(CompareArrays == true) { print("wooohoooo"); } //not sure about the 'print' command, I'm a C++ coder, so I use cout<< "blabla";}
would strcmp or memcmp work?
MEMCMP(3) NEWLIB MEMCMP(3)NAME 6.7 `memcmp'--compare two memory areasSYNOPSIS #include <string.h> int memcmp(const void *S1, const void *S2, size_t N);DESCRIPTION This function compares not more than N characters of the object pointed to by S1 with the object pointed to by S2.RETURNS The function returns an integer greater than, equal to or less than zero according to whether the object pointed to by S1 is greater than, equal to or less than the object pointed to by S2.PORTABILITY `memcmp' is ANSI C. `memcmp' requires no supporting OS subroutines.SEE ALSO memcmp is part of the libc library. The full documentation for libc is maintained as a Texinfo manual. If info and libc are properly installed at your site, the command info libc will give you access to the complete manual.NEWLIB 2006 Aug 09 MEMCMP(3)
if(array1[x] != array2[x]) { return false;}
Compared to the C language, C++ introduced extra features, including declarations as statements, function-like casts, new/delete, bool, reference types, inline functions, default arguments, function and operator overloading, namespaces and the scope resolution ( operator, classes (including all class-related features such as inheritance, member functions, virtual functions, abstract classes, and constructors), templates, exception handling, runtime type identification, and the overloaded input (>>) and output (<<) operators for input and output respectively.
Noob or not... that is the only way you can compare two arrays. In loop of somekind (for, while, do-while).