C语言如何使用指针

#include stdio.hint main () {intvar = 20;/* actual variable declaration */int*ip;/* pointer variable declaration */

编程学习网为您整理以下代码实例,主要实现:C语言如何使用指针,希望可以帮到各位朋友。

#include <stdio.h>

int main () {

   int  var = 20;   /* actual variable declaration */
   int  *ip;        /* pointer variable declaration */

   ip = &var;  /* store address of var in pointer variable*/

   printf("Address of var variable: %x\n", &var  );

   /* address stored in pointer variable */
   printf("Address stored in ip variable: %x\n", ip );

   /* access the value using the pointer */
   printf("Value of *ip variable: %d\n", *ip );

   return 0;
}

本文标题为:C语言如何使用指针

基础教程推荐