Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

C language pointers to array elements

2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

Pointers and operation rules pointing to array elements

A pointer to an array element is essentially the same as a pointer to a variable. Since each element in the array can be directly counted as a variable, the pointer to the array element, that is, the pointer to the variable.

Pointers to array elements are not difficult, but are commonly used. It will be more straightforward when we use the program to explain it.

Unsigned char number [10] = {0,1,2,3,4,5,6,7,8,9}; unsigned char * p

If we write p = & number [0]; then the pointer p points to element 0 of number, which assigns the address of number [0] to p, similarly, if we write p = & number [1]; p points to element 1 of the array number. P = & number [x]; where the size of x is 0,9, which indicates that p points to the x element of the array number. The pointer itself can also stop several complex operations, which are most frequently used in terms of pointers to array elements.

Analogy operation. The premise of comparison is that two pointers point to objects of the same type, such as two pointer variables p and Q, which point to an array of the same data type, then they can stop, > =, 0) {/ / when the data is to be sent, continue to send subsequent bytes SBUF = * ptrTxd; / / retrieve the data pointed to by the pointer cntTxd--; / / send counter plus ptrTxd++; / / send pointer increment}

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report