

if (-0.5 <= x <= 0.5) return 0;
-0.5 <= x is a bool

y?
x = 3; p = &x; y = x/*p /* p points to the denominator */ ;
int x = -2; // 0xFFFFFFFE if (x & 0x8000000 != 0) /* x is negative */
if (a[i] > max); max = a[i];
if (x % 2 == 1) /* x is odd */
x % 2 is -1 
int degrees = ...; degrees = degrees % 360; /* Normalize to 0...359 */
degrees is negative?degrees = ((degrees % 360) + 360) % 360;

printf("%d %s", 0.5, "liter");int x, y;
scanf("%d %d", x, y);3 4 Erreur de segmentation (core dumped)
printf/scanf is hardwired
char* lines[10];char (*row)[10];char* (*message)(int);void (*signal(int sig, void (*func)(int)))(int)
lines: array[10] of ↑char; row: ↑array[10] of char; message: function (int) → ↑char; signal: function(sig: int, func: function(int) → void) → (function(int) → void)
void swapNeighbors(int a[], int n) {
for (int i = 0; i < n; i += 2)
swap(a[i], a[i + 1]);
}n was odd?a[n - 1] was swapped with whatever happened to follow.a is a pointer to the start of the arrayat[], use a debugging vector implementation such as this onevector<int> a, b = ...;
int n = ...;
// Does b contain n?
vector<int>::iterator p = find(b.begin(), a.end(), n);
// If so, set to -1 and add to a
if (p != b.end()) { *p = -1; a.push_back(n); }
b.end()a to bfind operate on two iterators instead of a vector???int a[] = ...; int* p = find(a, a + size, n);
Point class with a constructor and default arguments
class Point {
double _x, _y;
public:
Point(double x = 0, double y = 0); // Sets _x to x, _y to y
// ...
};
int main() {
Point p(3, 4);
Point q(3); // (3, 0)
Point o(); // (0, 0)
...
} Point o();is a function prototype!

Point class with a constructor
class Point {
double _x, _y;
public:
Point(double x = 0, double y = 0); // Sets _x to x, _y to y
void print() const
// ...
};
int main() {
double r = ..., theta = ...;
Point p = (r * cos(theta), r * sin(theta));
// ...
} p to the point with polar coordinates r and theta?p._y is always 0Point p = (r * cos(theta), r * sin(theta));


LabeledPoint is just like a Point, but it has a label.
class LabeledPoint : public Point {
string label;
public:
virtual void print() const;
}
void LabeledPoint::print() const {
print(); // print base class to display x, y
cout << label;
}
print is recursivePoint::print()void LabeledPoint::print() const {
Point:print(); // print base class to display x, y
cout << label;
}Point:print();
LabeledPoint* to a Point*:
void print2(Point* p, Point* q) { p->print(); q->print(); }
...
print2(new Point(3, 4), new LabeledPoint(0, 0, "origin"));
void printAll(Point points[], int n) {
for (int i = 0; i < n; i++) points[i].print();
}
LabeledPoint lps[10]; ... printAll(lps, 10);

LabeledPoint array can be converted to a LabeledPoint* (array-pointer duality)LabeledPoint* can be convered to a Point* (base conversion)