What is the storage form of char type data in memory in C language?

烟雨青岚
Release: 2020-07-13 14:19:13
Original
20170 people have browsed it

In C language, the storage form of char type data in memory is ASCII code. In C language, char type data puts a character constant into a character variable. It does not put the character itself into the memory unit, but puts the corresponding ASCII code of the character into the storage unit.

What is the storage form of char type data in memory in C language?

In C language, the storage form of char type data in memory is ASCII code.

In C language, char type data is to put a character constant into a character variable. It is not to put the character itself into the memory unit, but to put the corresponding character of the character. ASCII codes are placed into storage units.

The C language makes character data and integer data universal. A character data can be output in character form or integer form.

When outputting in character form, the ASCII code in the storage unit needs to be converted into the corresponding characters first, and then output. When outputting in integer form, directly output the ASCII code as an integer.

Original code, complement code and complement code are binary fixed-point representation methods of numbers.

What is the storage form of char type data in memory in C language?

Extended information:

1. In computers, all data must be represented by binary numbers when stored and operated. (Because computers use high and low levels to represent 1 and 0 respectively)

ASCII code uses a specified 7-bit or 8-bit binary number combination to represent 128 or 256 possible characters. Standard ASCII code, also called basic ASCII code, uses 7 binary digits (the remaining 1 binary digit is 0) to represent all uppercase and lowercase letters, numbers 0 to 9, punctuation marks, and special controls used in American English. character.

2. There are three ways to represent symbolic numbers in computers, namely original code, complement code and complement code. All three representation methods have two parts: sign bit and numerical bit. The sign bit uses 0 to represent "positive" and 1 to represent "negative". However, the numerical bits are different in the three representation methods.

In computer systems, values are always represented and stored using two's complement codes. The reason is that using the complement code, the sign bit and the numerical field can be processed uniformly; at the same time, addition and subtraction can also be processed uniformly. In addition, the operation process of converting complement code and original code is the same, and no additional hardware circuit is required.

Recommended tutorial: "C Language Tutorial"

The above is the detailed content of What is the storage form of char type data in memory in C language?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!