1
$\begingroup$

Does computer convert every stuff using Ascii or UTF?
Meaning if there is a mathematical calculation including 65 (as a number) will it convert it into binary (00100001)?
And then how it differentiate it with 'A', whose code point is also 65 with code 00100001?

$\endgroup$
  • $\begingroup$ Computer does not convert anything, it does not know the meaning of variables, but gets firmatting for display to present for human. $\endgroup$ – Evil Aug 10 '16 at 16:34
  • $\begingroup$ This does not seem to be a computer science question. That said, your questions may have been answered here. $\endgroup$ – Raphael Aug 10 '16 at 21:22
  • $\begingroup$ Binary is electrical signals via switches in a circuit. Ascii tables are used above the most basic levels. 65 is 6 and 5. Six is also 2+2+2. 65 doesn't mean anything to a computer unless it is in a piece of software that tells the computer to read it in decimal form. Ask 65 to be translated by the ascii table and you get A, but the software has to tell the CPU what "it" is first. 'A' could be a letter or a reference or a variable, it depends on the context. The answer is software, firmware, integrated software... Software is everywhere, MS Word, Chrome Browser, Firefox... $\endgroup$ – ejbytes Aug 11 '16 at 22:50
1
$\begingroup$

I am not an expert in the field, but I can try to give an approximately correct answer.

Reading from memory itself, you can not diferentiate between lets say ints and characters. The compiled program is compiled with locations of where to find the operator that is needed, in this case print for ints and for chars. You must specify how to represent that data in your print command.

Example in c:

printf("ASCII value = %d, Character = %c\n", ch , ch );

This code will first represent data at location ch as a number and than as a char.

Let me give another example: Let us say that your language can "add" strings, in form of concatenating one onto another. How can computer know which "add" to use, if you cannot learn of data type from memory? The compiler compiled the program with address to the appropriate "add" command, according to data type you specified your operands to be.

Moral of the story: you cannot learn of data type from memory. Hopefully this clears it out.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.