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

Solve by completing the square x^2-2x-5=0
Simplify the expression by using a double-angle formula or a half-angle formula. 7cos^2(theta/9)-7sin^2(theta/9) sin(theta/6)cos(theta/6)
The coins in the store s cash register total $12.50. The cash register contains only nickels, dimes, and quarters. There are twice as many dimes as nickels. The
Tom took a trip of 1,020 miles . He traveled by train at 55 miles an hour and the same number of hours by plane at 285 mph . How many hours did the trip take?
Nancy sells handcrafted bracelets at a flea market for $6. If her monthly fixed costs are $625 and each bracelet cost her $1.75 to make, how many bracelets must
What is the square root of 25/9?
State whether set A and B are equal, equivalent, both, or neither. A = {9, 8, 7} B = {8, 9, 10}
The Cobb family decided to go roller skating for their reunion. There were a total of 44 people there and all went roller skating. If an adult admission was $5.
What is the difference between primary storage secondary storage and offline storage
in japan, what is karoshi?