What to learn when learning C language - "syntax" and "function library"

Publisher:少年不识愁滋味Latest update time:2015-03-25 Source: diangon Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
  The key to learning C language is to first understand what exactly you are learning when learning C language?

  When I asked this question, some students would open their textbooks, point to the table of contents and say, I know, I know, there are variables, data types, loop statements, functions, oh oh oh, there are also pointers, and so on!

  Unfortunately, if you think that learning C language is just learning these things, you have to correct your view quickly, otherwise the following learning will be difficult. Because I once fell into this pit. This narrow view made me waste a lot of time learning trivial details, and delayed my exposure to more important knowledge. The result was that I had high expectations but low skills - I knew a lot of useless knowledge that others didn't know, but I couldn't write any really decent programs.

  The so-called "grammar" is the content that is most emphasized in introductory textbooks, that is, the so-called variables, data types, branch judgments, loops, functions, pointers, etc.

  These contents are relatively boring, but the good news is that they are not difficult, they are all formatted things. As long as you practice more, they will be automatically engraved in your mind and become a subconscious habit.

  But "grammar" itself is actually useless. Because it is just a format specification. No matter how well you learn it, it cannot guide you to write a good program. Because in software design, the most core part is actually the "function library" part.

  What is a "library"?

  Simply put, a function library is a C function written by someone else and provided directly to you. You can achieve certain functions by calling the functions in it. For example, the printf() function, you must know that as long as you call this function, you can display a piece of text in that black window. You don't understand the internal working principle of printf(), but you know that as long as you call it according to the instructions, you can achieve the corresponding function.

  This is a function library - a collection of functions written by others, packaged and sent to you, which you can call freely to do various things.

  Let me talk about a few functions from the function library, such as the CreateWindowEx() function that can be used to create a window (this function is provided by Microsoft), the GaussianBlur() function that can be used to perform Gaussian blur processing on an image (this function is provided by OpenCV), and the evhttp_new() function that can create an HTTP server (this function is provided by libevent)...

  What other library functions are there? Too many. From controlling network communications, to capturing video footage and analyzing the location of faces in it, to encrypting and decrypting local files, and even sending and receiving WeChat messages, to grabbing Taobao product information... the number and usefulness of library functions far exceeds everyone's imagination.

  Huh? You've never heard of these things? They're not mentioned in the textbooks?

  That's because you are reading an introductory textbook that focuses on grammar and mentions a small number of C language library functions. In fact, C language contains quite a few library functions, but there are many more powerful third-party library functions, such as the ones I mentioned above.

  The point is, I want to tell you that library functions are the key to learning C language and applying it to practice! !

  It is extremely important to learn how to call other people's library functions, or even write your own library functions. Because a function is essentially a functional unit. The more infrastructure you have, the more room you have to play. It's that simple. This is the second point I need to emphasize to everyone. If you want to write practical C programs, a key is to study and learn how to use various library functions.

  You saw Wang Er next door wrote a 3D program that can make a colorful cube rotate in the air? Find the OpenGL library function to use. What? Liu Dabao wrote a network software that can chat in the local area network? Find the Socket library to use.

  See how important library functions are?

  However, learning a library is not isolated. Many library functions require certain domain knowledge. As mentioned in my first point, preparatory knowledge is required. Learning a library is not just about knowing how to call it, but also reflects our understanding of a specific field - network, digital image, cryptography, operating system, etc.

Reference address:What to learn when learning C language - "syntax" and "function library"

Previous article:The microcontroller communicates with the PLC through the programming port
Next article:Common brands of microcontrollers

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号