Ask Question
29 July, 02:56

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,

+5
Answers (1)
  1. 29 July, 06:48
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers