Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use pointer variables in C language

Shulou Source: shulou.com Published: 2022-06-03 17:40:58 11月14日 Update

This article will explain in detail how to use pointer variables in c language. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

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 c language". I hope the above content can be helpful to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Tags: Functions pointers arrays transfers variables languages articles parameters addresses more not bad practical consistent one-time entry content can pass data articles knowledge Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Redmi Linux MySQL macOS