Bo felt

  2019.1.11 is the first day I opened the blog, then I will update my blog every day, and every day I learned the sentiment Summary down and stick to it every day, when looked back, I hope it will become an asset. Come on! ! !

  First, let me share with you a video recorded on the B station, is about to break 200 views. https://www.bilibili.com/video/av70151218?from=search&seid=10538536088522894922

The little less than 3 minutes of video, talking about a few minor problems encountered in the STM32 download process, I will be a brief summary of it, of course, there are shortcomings, we want criticism and advice.

  Well, get on, I began to share what I learned today, or to review the knowledge points.

A, C language conditions include: C language specifically defines two prepared statements #ifdef and #define, their role is to check whether a function name has already been defined, if not defined herein will be redefined. E.g:

  #ifndef TheFly

  #define TheFly

  / * Here rest content TheFly file * /

  #endif

Second, the pointer function parameters (The following is an example of the book feel good, to help us better understand the pointer)

  Because of the way the language C is the value of the transmission parameter value passed to the called function, therefore, the called function can not directly modify the value of the main variables in the calling function. E.g:

  (Bad example)

  void swap(int x, int y)

  {

    int temp;

    temp = x;

    x = y;

    y = temp;

  }

The following statements can not achieve the purpose of the Change Order.

  swap(a,b);

This is because the swap (a, b) because the parameters passed by value employed, so the above swap function call will not affect the values ​​of the parameters a and b of its routine. This parameter is only exchanged copy of the value of a and b.

 

  (Right example)  

  void swap(int *px, int *py)

  {

    int temp;

    temp = *px;

    *px = *py;

    *py = temp;

  }

  The following statement can achieve this purpose.

  swap(&a, &b); 

  由于一元运算符&用来取变量的地址,这样&a就是一个指向变量a的指针。swap函数的所有参数都声明为指针,并且通过这些指针来间接访问他们的操作数。

 

Guess you like

Origin www.cnblogs.com/TheFly/p/11777469.html