Call function for block n on blockchain I've been going through main.cpp in order to roughly find out which function calls the best block and I found out depending on situation there are several similar-sounding function names and code extracts that I suspect of calling the best block.
Here's my list:


CBlockIndex *pindexBestKnownBlock
uint256 CCoinsView::GetBestBlock () const
CBlockIndex* pindexBestHeader
CBlockIndex* pindexBestForkTip 
pindexBestInvalid
// move best block pointer to prevout block
view.SetBestBlock(pindex->pprev->GetBlockHash());
chainActive.Tip()->GetBlockHash().ToString()


Now my question: Which one of the list items above can I use and modify in a way that calls a block that is n blocks deeper than the best block on the same blockchain?
The chainActive variable stores the best known block chain. But this is essentially just the chain of block headers, not the actual blocks themselves. To load the actual block from disk, use the ReadBlockFromDisk() function. But, be aware that this is an expensive function to use, it does not return immediately. 

chainActive[0] or chainActive.Genesis() [1]

Gives the genesis block header. 

chainActive[chainActive.Height()] or chainActive.Tip() [2]

Gives the header for the most recent block in the active chain. 

chainActive[chainActive.Height()-10]


Gives the block header for the block with 10 blocks built on top of it. 

Use any of these CBlockIndex pointers as below to get the block. 

CBlock block;
if (ReadBlockFromDisk(block, pindex)) {
    // do something
}