How to learn C language easily (1), learneasily
C language Learning Experience
Appendix: Why is it so domineering? recruit titles that the experts despise, as I wrote in my essay on C language, this is a C language article written by sisters. That's right !! The idea for writing this article also comes from a girl in Clanguage class who did not even put her schoolbag on her cell phone last week (just chatting with me ~~~), I learned that she was studying MOOC after class. I just saw how slow the array was! As a result, although the kid is not talented, he has a sense of justice and is determined to write a chapter on the C language Getting Started Guide for super universe invincible simple entry.
As a matter of fact, I learned python through the teachings of a great God in my freshman year. It is really a very convenient language. Miss inginging. After winter vacation, I learned a little bit about C/c ++;
Now, let's get started with the official nonsense (please remember, nonsense ~~~)! (I don't know how long a blog can be written. What if it's not enough ?)
Looking at the contents of a book, it's easy to understand.
First, let's talk about the stream of printf and scanf:
In python, print is used and a letter is missing.
Int a, B;
Scanf ("% d", & a, & B );
Printf ("% d", a, B );
Printf ("a = % d B = % d", a, B );
1. in scanf, % x must be connected to the same write, and only % x ...., nor can it write imaging like this scanf ("input: % d", & );
It is acceptable in python;
2. In scanf, the address and symbol must be added to all except % s (only one). Of course, the one in % s can also be added;
Do not add & this in printf...
3. It is particularly open in printf, and everything can be written in it, as long as it corresponds to a good location, a radish and a pitfall principle;
4. Bridge blackboard !!! This problem was encountered in the Q & A, and it feels helpful:
The wonderful use of printf:
Printf ("% *. * s \ n", m, n, ch );
* Defines the total width and * defines the number of outputs. The Parameter m and n correspond to the outer parameters respectively.
The advantage of this method is that values of m and n can be assigned outside the statement to control the output format.
5.% d: actual length
% Md. If the length is less than the left side, fill the sky gap. If it is too long, you will see the output based on the original length.
% C, % s: These two are always mixed at the beginning, because they are not distinguished in python; simply put, they are really simple. I was anxious about my IQ. I had a hard time in my computer class: % c is a = 'H'. I can only output a single character. Yes, it's just one. The appearance rate is very low. What about % s, a = "hahah", can output a string of characters, very useful.
Advanced: questions about musk code: 1. Don't remember !! At least every time I use it like this: char a; a = 'H'; printf ("% d", a); then I know the sk code of h (right, A single character is enclosed in single quotation marks ('') and a string of characters are enclosed in double quotation marks ("). All characters must be in English format !); 2. int x; x = 'B'-a'; the value is 1, because the musk code is connected! In this case, it is easy to understand how to convert uppercase to lowercase: char c = 'M'; c = 'M' + 'a'-'A '; printf ("% c", c); you see, it becomes an upper-case M and does not remember its value. The subtraction knows how to change to an upper-case value based on continuous storage;
6.% f: printf ("% m. nf", x). The length of m-is the same as % d. n-indicates the number of decimal places. Generally, you only need to control the number of digits after the decimal point is retained: printf ("%. nf", x ). (Here m, n must be numbers, not letters !!)
Then let's talk about this: What is main? Why do I have to write data every time? The include, "Ah ~ How can we fight in front of the program ?", In a C class, a sister next to me asked ...............
There are two methods:
1. # include <stdio. h> (# include <cstdio. h> unique to C ++)
Void main (){
}
2. # include <stdio. h>
Int main (){
Return 0;
}
Void means that only return 0 is required; return 0 is required for int; there is no advantage or disadvantage. Choose one in your mood.
All are routines .... Not to mention, remember now. At least you know what spelling is ....
Ah, it seems that the previous order is somewhat reversed... What about good organization .. No matter how simple it is, I finally got to the array.
Int a [10]; float B [88]; ---- int, float, char... are all called type names (this is very important for understanding pointers! Today is Saturday. If you want to go to bed early at night, you may not be able to tell the pointer... Later ~~ Later ~~) 10 88 is how many types of stuff can be installed. Don't think too much about it. In a word, make it bigger)
Write it here first. If someone has read the article, leave a comment, add a Q, and then speak out to ridicule me, I was so confident that I could get it done by thinking about an article. I wrote it to Xiao Bai (especially my sister-in-law paper). The more popular I Was At the beginning, the better I thought, after all, I have been in C language for half a semester. I also heard my sister say how to fight the include class .... But !!! Since the first official writing of articles, I feel that it is really not easy to write to others. I admire the great gods who use the dance in this context.
If you think this kid is a little interesting, leave a message to guide my C language series! I know a little bit of dog blood, a lot of deficiencies, ten times than remain!
Thank you! I will stick to the dog blood...