In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "what are the basic data types of C language". In the operation of actual cases, many people will encounter such a dilemma. Then let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
If you open any book in c language, we can see a picture like this.
Of course, what we are going to talk about now is the basic data type, that is, short,int,long,float,double,char, which is about a few. In fact, there are unsigned char,unsigned short,unsigned int, unsigned long, unsigned float, unsigned double and so on. These are all transformed on the basic data type, so we can literally know that unsigned is unsigned.
Let's start with byte (byte). One byte is equal to 8 binary bits (bit), and their relationship with kb,mb and so on is as follows:
1byte=8bit
1Kb=1024byte
1Mb=1024Kb
1Gb=1024Mb
1T=1024Gb
Int is used for the existence of integers, float and double are used to store decimals, and char is used to store the like. (although this is not rigorous, but let's not worry about it for beginners).
Next, let's talk about escape characters (that is, the characters you see are not what you see, or the transformed meaning) as shown in the following figure:
Maybe you look a little confused now, but it doesn't matter. Beginners always look confused at first. Then let's write the code.
The code is as follows:
# include
# include
Int main () {
Int a = 10 position / defines an and initializes it to 10, where = is not a mathematical equal sign, but means assignment. = = is the meaning of equals.
Char baud bins / defines and initializes b to the character k
Float c = 3.14 * / define and initialize c = 3.14
Printf ("aversion% dcentage% c jurisdiction% f\ n", a, b, c); printf ("int in bytes:% d in bytes:% d in bytes in float:% d\ n"
Sizeof (int), sizeof (char), sizeof (float); system ("pause")
Return 0;}
The above code, I have commented in great detail, (/ / this is called comment), but I think many students still have questions, I will talk about it again. First of all: "\ n" this is a line break. Second: the sizeof operator may seem a little strange (I'm talking about rookies), so you need to remember now that this operator is used to calculate the number of bytes a data type occupies in memory.
This is the end of the content of "what are the basic data types of C language". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.