Ask Question
16 March, 00:00

Write a program that checks the initial value in memory location x4000 to see if it is a valid ascii code and if it is a valid ascii code,

+4
Answers (1)
  1. 16 March, 03:28
    0
    You must dereference it as an unsigned char * to get a byte, then check if it is in the valid ASCII range of 32-127.

    void * ptr = 0x4000;

    unsigned char c = * (unsigned char*) ptr;

    if ((c>=32) && (c<=127))

    {

    / / Valid ascii

    }

    else

    {

    / / Not ascii

    }
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write a program that checks the initial value in memory location x4000 to see if it is a valid ascii code and if it is a valid ascii code, ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers