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

Why is there no ocean-continent divergence? I need to know I'm just in 6th grade
THE 3 STOOGES ARE ASKED WHO IS THE SMARTEST. TWO OF THEM ARE TRUTHFUL AND ONE IS A LIAR. LARRY SAYS CURLY IS THE SMARTEST, MOE SAYS LARRY IS THE SMARTEST AND CU
list 10 processes that occur while an organism is alive, but cease when it is dead.
4x+5y=20 write this equation in slope intercept form
how do you do scientific notation? what is 1.20 x 10 to the 3rd power
How would you find the zeros of the function by rewriting the function in intercept form? Ex: y=x^2-12x+32
how hot does it have to be to melt rock
how do you do scientific notation? what is 1.20 x 10 to the 3rd power
how do you do scientific notation? what is 1.20 x 10 to the 3rd power
how hot does it have to be to melt rock