Is the sizeof(some pointer) always equal to four?

he guarantee you get is that sizeof(char) == 1. There are no other guarantees, including no guarantee that sizeof(int *) == sizeof(double *). In practice, pointers will be size 2 on a 16-bit system (if you can find one), 4 on a 32-bit system, and 8 on a 64-bit system, but there’s nothing to be gained in … Read more

Unknown override specifier, missing type specifier

As @Pete Becker points out in the comments, you need to qualify the name string as std::string: The compiler just doesn’t know what you’re talking about, and it’s the equivalent of just writing: The compiler just doesn’t know what type that is unless you’ve declared, hence the error missing type specifier – int assumed You should read up … Read more

Copy a file in a sane, safe and efficient way

Copy a file in a sane way: This is so simple and intuitive to read it is worth the extra cost. If we were doing it a lot, better to fall back on OS calls to the file system. I am sure boost has a copy file method in its filesystem class. There is a C method … Read more

Read data from a file into an array – C++

The issue is that you’re declaring a local grades array with a size of 1, hiding the global grades array. Not only that, you are now accessing the array beyond the bounds, since the local grades array can only hold 1 item. So get rid of the line: However, it needs to be mentioned that this: is not valid C++ syntax. … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)