This series of articles will be taught in easy-to-understand dialogues that will cover common problems for beginners. This series will continue to be updated, including the use of dialogue in other languages as well as in the real world. Basic programming language teaching is applicable to the zero-based students, and the real world curriculum will be gradually updated.

If there is something you want to learn, you can leave a message in the comments section and keep updating according to your request. I’ll update the next one if I get 100, 000 likes. (Definitely not, and more.)

If you have any questions, leave them in the comments section.

If you like the content, welcome to follow me, comment, like, favorites, this is very important to me, thank you ~

directory

If I ask basic questions in a big group, no one will listen? “Peep big talk chat record to learn C language” (2) I said programming is easy to defy you? “Peep big talk chat record learn C language” (3) code are in love don’t you know? “Peep big talk chat record to learn C language” (4) originally I would program “peep big talk chat record to learn C language” (5) played a game I learned a programming knowledge?

Author’s brief introduction

Author name: 1_bit introduction: CSDN blog expert, 2020 TOP5 blog stars

🐰 small C: small yuan, how, the content of the last lesson absorbed almost?

👸 small yuan: well, the feeling is quite easy, listen to a practice will be. 😜

🐰 C: Let’s continue our lesson. In the last video we looked at how to create variables, so I asked you, how do you create multiple variables?

👸 Yuan: Well… This… Is that so? 😰

#include<stdio.h>
#include<stdlib.h>
void main(a){
	int a=10;
	int b=10;
} 
Copy the code

🐰 small C: good ah, actually answer right, this is a way, I thought you would write this. 😶

#include<stdio.h>
#include<stdlib.h>
void main(a){
	int a=10;
	int a=10;
} 
Copy the code

👸 small yuan: you so affirmation is wrong, because the name can only use can only use once, used to have two identical thing, divide not clear. 😂

🐰 small C: oh, oh, you can understand, good.

👸 xiaoyuan: This is not normal logic? 😂

🐰 small C: ha ha ha, you can think of it. I’m going to show you another way to create multiple variables at once. Look at the code below.

#include<stdio.h>
#include<stdlib.h>
void main(a){
	int a=10,b=11;
} 
Copy the code

👸 Xiaoyuan: Wow, originally can also like this, int directly to a and B two variables modified, really convenient. 😆

🐰 small C: you how brain suddenly enlighten, “modify” this word unexpectedly you use out, and very good explanation this int function. But one thing to keep in mind here is that the comma between these two variables is used to indicate the interval, and the function of the comma in C language is to separate the function.

👸 small yuan: that I understood, after want to space of time with comma separate right?

🐰 Little C: Yes. Moving on, let me ask you one more question, how do I use printf to display two variables at the same time? 👸 Yuan: Well… I really don’t understand, hahaha, just printf two lines? 😂

#include<stdio.h>
#include<stdlib.h>
void main(a){
	int a=10,b=11;
	printf("%d",a);
	printf("%d",b);
} 
Copy the code

🐰 small C: ha ha ha, you this not at the same time, we have to output at the same time.

👸 Xiaoyuan: How do you do that? 😂

🐰 Small C: Simple, you take a look at the following example.

#include<stdio.h>
#include<stdlib.h>
void main(a){
	int a=10,b=11;
	printf("%d %d",a,b);
} 
Copy the code

👸 xiaoyuan: Huh? I can understand the use of commas between %d and % b, because you just said that commas are used to separate %d. Why not use commas between %d and % D? So what do these %d’s do? 😳

🐰 small C: Let me answer your first question. As we said before, in the double quotation marks of printf, you can put whatever you want inside the quotation marks. If you put a comma, will the comma be displayed as it is?

👸 Xiaoyuan: It seems so. 😁

🐰 small C: Ok, let’s talk about the second question, %d is a placeholder, the output will be the value of the following variables, here the two %d corresponds to a and B variables respectively, the first %d corresponds to a, the second %d corresponds to b, so you can display the values of a and B variables. Let me show you the result. I’ll put in a comma to show you.

#include<stdio.h>
#include<stdlib.h>
void main(a){
	int a=10,b=11;
	printf("%d,%d",a,b);
} 
Copy the code

👸 xiaoyuan: the original comma is really the original output duck. So if I create 3 variables, do I do all 4 variables like this, like this. 😁

#include<stdio.h>
#include<stdlib.h>
void main(a){
	int a=10,b=11,aa=1,bb=2,c=13;
	printf("%d,%d,%d,%d,%d",a,b,aa,bb,c);
} 
Copy the code

🐰 small C: yes, it seems that your brain began to understand today, good, continue to refueling.

👸 small yuan: all the time very flexible of good. 😌

🐰 small C: ha ha ha, I now tell you about some variable naming methods.

👸 Xiaoyuan: Variables also have naming methods? 😢

🐰 Little C: Yes, because most of the programming is a team developing a project, unifying a standard and style of programming will improve efficiency when reading the code.

👸 Xiaoyuan: I can’t understand. 😢

🐰 small C: so tell you, you are programming to do a game, there are health, fire damage to all of you have aa and bb for name, if you the game become very big, every time I see aa and bb don’t even know what this variable is stem what of, this time you will need to see what this variable is done, then will have a headache. If you call aa something like HP, it’s pretty obvious.

👸 Xiaoyuan: That’s what it means. ☺ ️

🐰 Small C: We have a unified naming standard, of course you can not follow the standard to do, but a good naming of your own project is also efficient to help. General hump naming, Hungarian naming, PASCAL naming, underline naming and so on. 👸 xiaoyuan: so many names, which one should I use?

🐰 Little C: You just need to know about these naming methods, and you can apply whatever method your team uses in the future.

👸 Xiaoyuan: Well, then you tell me how these naming methods are named.

🐰 Little C: The name of the hump is very graphic. For example, I have a variable named dogAge, the first letter is lowercase, and the second word is uppercase, just like the camel’s peak. I know from the name that the variable is used to store the age of the dog.

👸 Xiaoyuan: Wow, it’s really clear. ☺ ️

🐰 Little C: Hungarian nomenclature adds a description name to an attribute. For example, if you need to create a variable whose age is an integer, you can write it as isex, which means sex of type int.

👸 Xiaoyuan: Wow, so you can know the type of the variable from the name of the variable, very good. 😏

🐰 little C: PASCAL nomenclature: The PASCAL nomenclature is similar to the hump nomenclature, in that all English words need to start with a capital letter, such as MyAge.

👸 Xiaoyuan: Do I use PASCAL or hump?

🐰 small C: this need not tangle, you develop your own time to use what you like to use. As we continue, the underscore naming convention is to use underscore spacing when multiple English words are combined, such as my_age.

👸 Xiaoyuan: how do I feel I like the underline naming method, ha ha ha. I’ll try it. Write two programs. 😉

🐰 Small C: Well, you go to practice, we this class first like this, have a rest.