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

Many women replaced men on the baseball field and in factories
Name the two kingdoms that only contain prokaryotes.
The slope of a line is 2/3. What is the slope of a line that is perpendicular to this line? Type a numerical answer in the space provided. Do not include spaces
How did improvements in agriculture in the countryside likely affect the lives in townspeople
Choose the terms that describe timbre.
Use inductive reasoning to describe each pattern and find the next two terms of each sequence. 1, 4, 9, 16, 25, …
which of the following pairs of words are antonyms despondent, ecstatic solitude, lonely captivity, slavery essay, clarity Please help me
Does the number of chromosomes correspond to the complexity of an organism?
A water molecule is lost when two glucose units come together to form a molecule of lactose. Which type of reaction is involved in the formation of the lactose
Your science teacher gives you three liquids to pour into a jar. After pouring, the liquids layer as seen here. What property of matter prevents the three liqui