c语言指针变量初始化
In this tutorial, we will learn how to declare, initialize and use a pointer. We will also learn what NULL pointer are and where to use them. Let's start!
在本教程中,我们将学习如何声明,初始化和使用指针。 我们还将学习什么是NULL指针以及在哪里使用它们。 开始吧!
C指针变量的声明 (Declaration of C Pointer variable)
General syntax of pointer declaration is,
指针声明的一般语法是
datatype *pointer_name;
Data type of a pointer must be same as the data type of the variable to which the pointer variable is pointing. void
type pointer works with all data types, but is not often used.
指针的数据类型必须与指针变量指向的变量的数据类型相同。 void
类型指针适用于所有数据类型,但并不经常使用。
Here are a few examples:
这里有一些例子:
int *ip // pointer to integer variable
float *fp; // pointer to float variable
double *dp; // pointer to double variable
char *cp; // pointer to char variable
C指针变量的初始化 (Initialization of C Pointer variable)
Pointer Initialization is the process of assigning address o