0
Guys, does anyone know what this code means in c++?
#include <iostream>
#define MAX_C (10)
using namespace std;
int compar(const void *x, const void *y) {
int a = *((int *) x);
int b = *((int *) y);
return a - b;
}
0
Guys, does anyone know what this code means in c++?
#include <iostream>
#define MAX_C (10)
using namespace std;
int compar(const void *x, const void *y) {
int a = *((int *) x);
int b = *((int *) y);
return a - b;
}
0
Good Morning,
Analyzing the code, the big difference is the use of Library Iostream, which in this code, frankly, is not valid. For at no time is anything called from this library.
This #define is also not being used in this code. And if the goal is to have a constant, use const int = MAX_C 10;
As for the function, it returns the difference between two pointers. In which a cast is cast for int.
It would be more cool to use a Template, since we are talking about C++.
Hugs
const
that’s not quite it. constexpr
would be appropriate.
Browser other questions tagged c c++
You are not signed in. Login or sign up in order to post.
this method returns the difference of two values within pointers.
– Brumazzi DB
I was a little confused, where enters the "Conversion C to C++" of the title in doubt?
– Bacco
I believe it is because this code has all the face of C; in C++ could do using templates..
– PerryWerneck
This code is already C with the exception of Std.
– krystalgamer