A transfer function is used to transfer information between variables of different types.
Many older programming languages refer to these as type conversions, data conversions, or just, conversions.
table of contents
If you like the idea of this project,
then please donate some money.
more information on donating
This subchapter is a stub section. It will be filled in with instructional material later. For now it serves the purpose of a place holder for the order of instruction.
Professors are invited to give feedback on both the proposed contents and the propsed order of this text book. Send commentary to Milo, PO Box 1361, Tustin, California, 92781, USA.
This subchapter looks at transfer functions.
A transfer function is used to transfer information between variables of different types.
Many older programming languages refer to these as type conversions, data conversions, or just, conversions.
ALGOL entier(E) ALGOL-60 library function that returns the largest integer not greater than the expression.
BASIC INT(x) BASIC library function that returns the integer portion of an expression. The result is the largest whole number (integer) that is not greater than the expression.
BASIC VAL(x) BASIC library function that returns the integer value of a character string or expression. Note that some versions of VAL will strip out leading blanks..
BASIC CHR$(x) BASIC library function that returns the single element character string containing the ASCII character equivalent of an integer expression in the range of 0 to 255.
Pascal char(x) Pascal standard function that returns the CHAR character that matches the position in the collating sequence of an argument x.
BASIC ASC(x) BASIC library function that returns the decimal ASCII value of a string variable..
The following material is from the unclassified Computer Programming Manual for the JOVIAL (J73) Language, RADC-TR-81-143, Final Technical Report of June 1981.
Since JOVIAL has quite a few kinds of values, it must have many
ways of converting one kind of value into another kind. In most
cases, you must explicitly indicate the conversion. An example
is:
ITEM MARK U 10;
ITEM TIME F;
...
MARK = (* U 16 *) (TIME);
The value of the floating item TIME is converted to a ten-bit
integer value before it is assigned to the ten-bit integer item
MARK. If you leave the conversion operator out of this
assignment, the compiler will report an error. The compiler
catches situations in which one type of value is uninetentionally
assigned to or combined with a different type of variable.
Chapter 1 Introduction, page 7
Data conversion instructions change data from one format to another.
A sign extension operation takes a small value and sign extends it to a larger storage format (such as byte to word).
A type conversion operation changes data from one format to another (such as signed twos complement integer into binary coded decimal).
See also Data Conversion Instructions in Assembly Language
Coding example: I am making heavily documented and explained open source code for a method to play music for free almost any song, no subscription fees, no download costs, no advertisements, all completely legal. This is done by building a front-end to YouTube (which checks the copyright permissions for you).
View music player in action: www.musicinpublic.com/.
Create your own copy from the original source code/ (presented for learning programming).
return to table of contents
free downloadable college text book
Because I no longer have the computer and software to make PDFs, the book is available as an HTML file, which you can convert into a PDF.
Building a free downloadable text book on computer programming for university, college, community college, and high school classes in computer programming.
If you like the idea of this project,
then please donate some money.
send donations to:
Milo
PO Box 1361
Tustin, California 92781
Supporting the entire project:
If you have a business or organization that can support the entire cost of this project, please contact Pr Ntr Kmt (my church)
This web site handcrafted on Macintosh computers using Tom Benders Tex-Edit Plus and served using FreeBSD .
UNIX used as a generic term unless specifically used as a trademark (such as in the phrase UNIX certified). UNIX is a registered trademark in the United States and other countries, licensed exclusively through X/Open Company Ltd.
Names and logos of various OSs are trademarks of their respective owners.
Copyright © 2010, 2012 Milo
Created: October 31, 2010
Last Updated: September 21, 2012
return to table of contents
free downloadable college text book