Prime number calculator using Sieve of Eratosthenes
This is written like C code; there are lots of things you're doing that would be much nicer using the tools C++ gives you.

First, though, I'm not a fan of a global using namespace std, so I removed it.

You're using lots of longs; it's best to replace them with int64_ts for consistency. Perhaps some size_ts would work well, too, but it doesn't seem like an improvement to the API. You should also initialize them in the loops or as late as possible.

Your bool * a should be replaced with a std::vector&lt;bool&gt;; not only is it far easier but it's likely faster and takes less space.

You don't need to return 0.

Your

int64_t c = 0;
for(int64_t i = 2; i &lt; n; i++) {
    if(a[i]) {
        //std::cout &lt;&lt; i &lt;&lt; " ";
        c++;
    }
}


can be just

int64_t c = std::count(std::begin(a), std::end(a), true);


using the algorithm standard library.

C++ compilers can tell that sqrt(n) is constant, so you don't need to assign it to a variable.

It's standard in C++ to do ++i over i++, although it won't matter in this case.

You can initialize your vector with

std::vector&lt;bool&gt; a(n, true);
a[0] = a[1] = false;


to avoid the first loop.

Your loop

for(int64_t k = 0, j = 0; j &lt;= n; j = (i * i) + (k * i), ++k) {
    a[j] = false;
}


can be simplified to

for(int64_t j = i * i; j &lt; n; j += i) {
    a[j] = false;
}


This does loop over slightly different values (it avoids j=0), but those values were likely unintended anyway.

For your timings, you should use chrono. This is long and verbose, but it's a so much better library that you should just deal with the hassle.

You validate against argc but not whether the input is a valid number. Try using istringstream to do that:

int64_t n;
if (!(std::istringstream(argv[1]) &gt;&gt; n)) {
    std::cout &lt;&lt; "Number invalid." &lt;&lt; "\n";
    return 1;   
}


Note that this allows input like "   6-afsadf" or "  34 2 " which parse as 6 and 34 respectively; a full check is more complicated.

You should probably separate the prime-counting code from the input-output code, although this requires a bit of hassle to return multiple values:

namespace ch = std::chrono;

std::pair&lt;int64_t, ch::steady_clock::duration&gt; primes_count_and_time(int64_t n) {
    ... // code

    auto elapsed = ch::steady_clock::now() - start;
    int64_t count = std::count(std::begin(a), std::end(a), true);
    return {count, elapsed};
}

int main(int argc, const char * argv[]) {
    ... // code

    int64_t count;
    ch::steady_clock::duration elapsed;
    std::tie(count, elapsed) = primes_count_and_time(n);

    ... // code
}


Now we have some simple optimizations to apply; you can start by dropping the odd values from the vector:

for(int64_t i = 1; i &lt;= sqrt(n / 2 + 1); ++i) {
    if(a[i]) {
        // The start is:
        //      compress(uncompress(i)²)
        //          = ((2*i+1)² - 1) / 2
        //          = 2 * i * (i+1)
        for(int64_t j = 2*i*(i+1); j &lt; n / 2 + 1; j += 2*i+1) {
            a[j] = false;
        }
    }
}


This takes 3.3 seconds for \$n = 10^9\$ for me, where the old version took 11.2. All of the changes are below:

#include &lt;algorithm&gt; // count
#include &lt;chrono&gt;    // steady_clock
#include &lt;cmath&gt;     // sqrt
#include &lt;iostream&gt;  // cout
#include &lt;iterator&gt;  // begin/end
#include &lt;sstream&gt;   // istringstream
#include &lt;tuple&gt;     // tee
#include &lt;utility&gt;   // pair
#include &lt;vector&gt;    // vector

namespace ch = std::chrono;

std::pair&lt;int64_t, ch::steady_clock::duration&gt; primes_count_and_time(int64_t n) {
    std::vector&lt;bool&gt; a(n / 2 + 1, true); // 2, 3, 5, 7... might be prime

    auto start = ch::steady_clock::now();

    for(int64_t i = 1; i &lt;= std::sqrt(n / 2 + 1); ++i) {
        if(a[i]) {
            // The start is:
            //      compress(uncompress(i)²)
            //          = ((2*i+1)² - 1) / 2
            //          = 2 * i * (i+1)
            for(int64_t j = 2*i*(i+1); j &lt; n / 2 + 1; j += 2*i+1) {
                a[j] = false;
            }
        }
    }

    auto elapsed = ch::steady_clock::now() - start;
    int64_t count = std::count(std::begin(a), std::end(a), true);
    return {count, elapsed};
}

int main(int argc, const char *argv[]) {
    if(argc == 1) {
        std::cout &lt;&lt; "Please enter a number." &lt;&lt; "\n";
        return 1;
    }

    int64_t n;
    if (!(std::istringstream(argv[1]) &gt;&gt; n)) {
        std::cout &lt;&lt; "Number invalid." &lt;&lt; "\n";
        return 1;   
    }

    int64_t count;
    ch::steady_clock::duration elapsed;
    std::tie(count, elapsed) = primes_count_and_time(n);

    double seconds = ch::duration_cast&lt;ch::duration&lt;double&gt;&gt;(elapsed).count();
    std::cout &lt;&lt; std::fixed
              &lt;&lt; "\nCalculated " &lt;&lt; count
              &lt;&lt; " prime numbers up to " &lt;&lt; n
              &lt;&lt; " in " &lt;&lt; elapsed.count()
              &lt;&lt; " clocks (" &lt;&lt; seconds &lt;&lt; " seconds).\n";
}