MagicDragon888 MagicDragon888
  • 21-12-2018
  • Computers and Technology
contestada

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,

Respuesta :

tonb
tonb tonb
  • 21-12-2018

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

}

Answer Link

Otras preguntas

Point B is on the graph of the function f(x) = -3x2. If the x-coordinate of point B is 2, which ordered pair gives the location of point B?
What happened during the holocaust?
Millions of Americans are subjected to drug testing in the workplace.  The tests are not always reliable.  A false positive rate of 5% is considered to be a con
Why can't you change the subscripts in a formula in order to balance a chemical equation?
Ms. Booth has 16 red buttons and 24 blue buttons. She is making finger puppets. Each puppet has the same number of blue buttons and red buttons. How many puppet
3 sisters, veronica, Mary and aAnna went out on a blind date with 3 brothers.  Veronica ended up holding hands with her date.  Mary certainly wasn't the one kis
Explain how the types of mountain landforms are related to one another.
What is the total energy of a 175,000kg shuttle orbiting the Earth at 600km above Earth's surface?
What happened during the holocaust?
Describe the typical movement of ciliates.