Create a boolean array " mark [ 0 . . n - 1 ] " and initialize all entries of it as true . A value in mark [ p ] will finally be false if ' p ' is Not a prime , else true .
vector < bool > mark ( limit + 1 , true ) ; for ( int p = 2 ; p * p < limit ; p ++ ) {