Memory C-language operators (end-of-text benefits)

Source: Internet
Author: User
Tags arithmetic operators bitwise logical operators

Click above "Asynchronous Community", select" Top Public number "

Technical dry, first time delivery



When you learn the first programming language, you probably read a book, enter code that you don't understand, and try to understand how it works. most of the other books I write are like this, which is very effective for beginners. As a beginner, there are some complex topics that you need to learn to use before you know them, so it's a simple way to learn.

However, once you have learned a programming language, this slow-pace approach to grammar is less effective. It is possible to learn a language in this way, but there is a quicker way to learn programming skills and build confidence in your use. This method of learning programming is like magic, but you have to believe me, it works surprisingly well. If you think the article is not enough to see, you can first take out a mobile phone to watch a video.

Scan to see the video

when learning C, I want you to first memorize all the basic symbols and grammar, and then use them in a series of exercises. This approach is similar to the process of learning human languages: memorizing words and grammar, and then using the things you remember in conversations. As long as you start to work hard to remember something, you have enough basic knowledge to read and write C code in the future.

Warning

Some people are extremely opposed to memorizing memories. Usually they say it kills your imagination and makes you a nerd. Not really, I am a living proof. I can paint, play the guitar, make guitars, sing songs, write code, write books, and I carry a lot of things. Therefore, this argument is not only unfounded, but also undermines learning efficiency. Don't take their words seriously.

1.1 How to Remember

The best way to remember is to be simple.

1. Create a series of shorthand cards, write the symbols on one side, and write the descriptions on the other side. You can also use a program called Anki to do this on your computer. I like to make my own shorthand card, because the process of making it also helps to remember.

2. Shuffle the shorthand card and start browsing one by one, just look at one side and try to think about the other side of the content, and don't worry about the answer.

3. If you can't remember the other side of the content, then look at the answer , then repeat the answer, and then put the card in a separate pile inside.

4. After reading all the cards, you have two stacks of cards : A stack is something you can remember quickly, and the other pile is something you don't remember. pick up the pile that you don't remember and work hard to remember the cards.

5. After a phase is over (usually 15-30 minutes), you still have a stack of cards that you don't remember. carry these cards with you, and if you are free, take a moment to memorize the contents.

There's a lot of memory skills, but I've found that this is the best way to get you to think about what you need to be able to use instantly. C language symbols, keywords, grammar is what you need to think about immediately, so this method is most applicable.

Also keep in mind that you need to do the double-sided memory of the card. You should be able to know the corresponding symbol by description, and also to know its description from the symbol.

Finally, you don't have to stop to memorize these operators. The best way to do this is to combine it with the exercises in the book in order to apply the contents of the memory. See the next exercise for this.

1.2 List of Operators

the first thing to list is the arithmetic operators, which are similar to the arithmetic operators in almost every programming language. when writing a card, the description writes it as an arithmetic operator and describes its specific function.

Relational operators are used to test equivalence, and they are common in a variety of programming languages.

Logical operators are used for logic tests, and their capabilities you should already know. The only special is the logical ternary operator (logical ternary), which you will learn later in this article.

What the bitwise operator does is not often seen in modern code. They change the bits that make up the bytes and other data structures in various ways. I'm not going to talk about this in this article, but in some specific types of underlying systems, they can be very handy.

The function of an assignment operator is to assign an expression to a variable, but many of the operators in the C language can be combined with an assignment. So, when I say "and-equal," I'm talking about the bitwise operator, not the logical operator.

I call the following operations a data operator, but they are actually dealing with pointers, member accesses, and the elements of the various data structures of the C language.

Finally, there are miscellaneous symbols, which are either variable (for example,) or cannot be categorized for a variety of reasons, so they are listed below.

While learning a shorthand card, continue reading this article. If you spend 15-30 minutes on a shorthand card before each study, and you spend 15-30 minutes a day before you go to bed, you can remember it in a few weeks.

Memory C language Grammar

After learning the operators, it is time to memorize the keywords and basic grammatical structures you will use. Believe me, you spend a small amount of time in your memory, and you will be rewarded with great rewards for reading this article later.

As I mentioned in Exercise 5, you don't have to stop reading this article specifically to remember that you can do both at the same time, and you should do the same. Use your shorthand card as a warm-up before coding every day. Take the card out, back for 15-30 minutes, and sit down to do the exercises in this article. as you read this article, try to use the code you entered as a memory practice. One trick is to collect the shorthand cards for the operators and keywords that you can't see directly after you write the code. After a day's study, spend another 15-30 minutes learning to memorize the contents of these cards.

By insisting on doing so, you can learn C language faster and more firmly. This is much more efficient than just entering code, hitting the wall, and finally getting a bunch of second-hand memories.

1.3 Key Words

Keywords in programming languages (keyword) are some of the words that extend their set of symbols, which make programming languages easier to read. There are some languages (such as APL) that do not have real keywords, and some languages (such as Forth and Lisp) have almost nothing but the keywords. In the middle are languages like C, Python, Ruby and many other languages, the basic content of which is composed of keywords and symbols.

Warning

The process of processing symbols and keywords in programming languages is called the lyrics Analysis (lexical). These symbols and any of the words in the keyword are called lyrics (lexeme).

Keyword description


1.4 Grammatical structure

I recommend that you remember these keywords and also remember the grammatical structure. the grammatical structure (syntax structure) is a series of symbolic patterns used to form the code format of a C program, such as an if statement or a fixed structure such as a while loop. You should find that most of the following are familiar because you have learned a language. The only thing you have to do is to learn how it is done in the C language.

Here's how to read these things.

    1. Full capitalization means that the location needs to be filled in with content or slots.

    2. Seeing all uppercase in square brackets means that this part of the content is optional.

    3. The best way to test your memory of a grammatical structure is to open a text editor, where you see a switch statement, say its function, and then try to write out the code format.

The IF statement is the Basic Logical Branch Control tool:

A switch statement is similar to an if statement, but it is valid for simple integer constants:

The while loop is the most basic loop:

You can also use continue to implement loops. We call it a while-continue loop for the time being:

You can also use break to exit the loop. We call it a while-break cycle:

The Do-while loop is the reversal of the while loop, which runs the code first and then tests the condition to see if it needs to run the code again:

It can also have continue and break in it to control how it operates.

A For loop is a controllable count loop that uses counters to achieve (desired) fixed iterations of the iteration:

An enum creates a set of integer constants:

Goto jumps to the location of a label and is useful in very few cases, such as error detection and exit:

The function is defined like this:

This may not be easy to remember, so take a look at the following example, and then you'll know what the type, NAME, ARG, and Value are, respectively:

typedef is used to define new types:

The more specific examples are as follows:

Do not be deceived by the space, in this case, the definition corresponds to the unsigned char,identifier corresponds to the byte.

A struct is a concept that is packaged together by a variety of data types and is used extensively in the C language:

[Variable_name] is an option, except for a few small scenes, I generally choose not to use it. It is usually used in combination with the typedef as follows:

Finally, Union creates something like a struct, but the elements in it overlap in memory. This thing is very strange, not understand, so for the moment to remember this is good:

1.5 Words of encouragement

After you create a shorthand card for each item, start with the name and then read the description and usage format on the back. In the video of this exercise, I showed you how to do this efficiently with Anki, but you can do it with simple index cards as well.

I have noticed that some students will feel uncomfortable or frightened when they experience such memorization tasks. I'm not sure why, but I encourage you to do it anyway, as an opportunity to improve your memory and learning skills. Practice makes perfect, and the more you do, the easier it will be for you.

If you feel uncomfortable or depressed, it's also normal, don't take it seriously. Maybe you spent 15 minutes and then got so upset that you felt like a failure. It's normal, and that doesn't mean you really fail. Perseverance, you can get through the first depression period, this exercise will teach you two things.

    1. you can use memory as a self-assessment. there is nothing more plausible than a memory test to know how much you have mastered one thing.

    2. the way to overcome difficulties is to conquer one point at a time. programming is a good way to learn this technique, because in programming you can easily cut the problem into small chunks and then target them. Take this as an opportunity to carve out big tasks into small tasks to build confidence.

1.6 Warning Words

I have one last word of caution about memorizing memories. Remembering a large number of knowledge points does not automatically make you an expert in applying this knowledge. Even if you recite the entire ANSI C standard, you may still not be a good programmer. I've met a lot of people who know almost everything about standard C grammar, and they're supposed to be a C-language expert, but they still write bad, weird, flawed code, and some can't even write code.

Do not confuse the ability to memorize knowledge points with the ability to accomplish tasks with high quality. To really be a master, you need to apply these points of knowledge on different occasions until you know how to use them. The rest of this article will help you do that.


This digest from the "Stupid Method" study C language

"Stupid method" learning C language

[Mei] Zed A. Shaw (Zed A. Shaw)

Click on the cover to buy a paper book

This book is accompanied by a 5-hour passionate video, a complete C-language video course!

author Zed A.shaw has built a course for beginners in C language who are eager to improve their programming skills (no language), so as long as you learn , you will be as successful as the millions of programmers who have so far been taught by Zed! As long as you can self-discipline, devotion and perseverance! This book is very simple and easy to read, as long as it takes 2 days to 1 weeks to finish reading, after reading both can get thousands of lines of code C programming experience. This book will give you a reward for every minute of your investment. You'll soon be able to learn one of the world's powerful programming languages and become a C programmer.

This book is written for readers who have studied programming languages, the book is interesting, simple, and the method is unique, let the reader understand the basic knowledge of the C language and the common defects in C programs, while slowly enhancing their technical capabilities, while in-depth understanding of how to destroy the program, and how to make the code more secure.

Small welfare

focus on the "async community" service number, forward this article to a circle of friends or more than 50 people, send to the asynchronous community service number backstage, and in the article you learn C language experience, or probation the book feel, we will elect 3 readers to give "stupid method" learn C language "1", and actively participate in it!
Event deadline: May 3, 2018


In the " Async Community " Backstage reply " concern ", you can get free 2000 online video courses ; recommend friends follow the tips to get books link, free to get an asynchronous book. Come and join me!

Sweep the QR code above, reply to the "Attention" participation activities!

Read the original, buy "stupid method" study C language

Read the original


Memory C-language operators (end-of-text benefits)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.