c语言指针变量初始化_在C中声明,初始化和使用指针变量

本文教程介绍了C语言中如何声明、初始化和使用指针变量,包括指针声明的一般语法,指针初始化过程,以及使用指针和指针解引用的方法。同时强调了指针变量必须指向相同数据类型的变量,并提到了NULL指针的使用。
摘要由CSDN通过智能技术生成

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值