Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to use pointer variables in C language

Shulou Source: shulou.com Published: 2022-05-31 10:55:34 11月02日 Update

This article mainly introduces the relevant knowledge of how to use pointer variables in c language, the content is detailed and easy to understand, the operation is simple and fast, and has a certain reference value. I believe you will gain something after reading this article on how to use pointer variables in c language. let's take a look.

1. As the transmission of function parameters, the address of the parameters we need has been transferred through the pointer in the function.

Int axiom 1 and int one (int * a recorder int * b) {function body} one (& a dint b)

2. Pass the array to the function. An array is a collection of data.

It cannot transfer all functions at once. We can transfer the array through the pointer and then manipulate the array.

Use the pointer as the function return value:

C language allows the return value of a function to be a pointer. We call the function that returns a pointer a pointer function.

# include#include#include// defines a function pointer. Initialization can only assign the function name void a (void (* p) ()) {p ();} void b () {printf ("I am function b\ n");} int main () {void (* p) (); / / defines a function pointer variable, which is used to store the entry address of the function. / / pass a behavior system ("pause"); return 0;} this is the end of the article on "how to use pointer variables in the c language". Thank you for reading! I believe you all have a certain understanding of the knowledge of "how to use pointer variables in c language". If you want to learn more, you are welcome to follow the industry information channel.

Tags: Functions pointers variables languages arrays transfers knowledge content parameters addresses articles consistency one-time value entry can be passed easy to operate data articles easy to understand Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Shulou Technology vpn MariaDB Redmi