This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Null Pointers

What happens if i try to write data to memory location where NULL POINTER is pointing, in ARM?
_my understanding_ The Null Pointer is a Pointer pointing to 0. Does that mean memory location 0x0(the reset vector address, writing to this memory location is definitely not possible without IAP. so it may not be pointing 0x00 memory address)?

Or does it mean that the Pointer is pointing to nothing? If pointer is pointing to nothing, then where is the data being written in the following code if pQEI becomes a NULL POINTER?

void QEI_Init(uint8_t qeiId, QEI_CFG_Type *QEI_ConfigStruct)
{
        LPC_QEI_TypeDef* pQei = QEI_GetPointer(qeiId);

        pQei->MAXPOS = 0x00;
        pQei->CMPOS0 = 0x00;     //where is 0x00 being written if the pQEI becomes NULL POINTER
        .
        .
        .
        /* an so on*/
}

LPC_QEI_TypeDef* QEI_GetPointer(uint8_t qeiId)
{
        LPC_QEI_TypeDef* pQei = NULL;

        if(qeiId == 0)
        {
                pQei = LPC_QEI;
        }

        return pQei;
}