Ask 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,

+5
Answers (1)
  1. 21 May, 02:57
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers