您现在的位置: 中国男护士网 >> 考试频道 >> 计算机等级 >> 二级辅导 >> C语言 >> 辅导 >> 正文    
  间接修改指针的地址 【注册男护士专用博客】          

间接修改指针的地址

www.nanhushi.com     佚名   不详 

   间接修改指针的地址 
    代码: 
// test for a pointer.cpp : Defines the entry point for the console application. 
// 
#include "stdafx.h" 
#include <iostream> 
using namespace std; 
typedef struct 

 int *p; 
}Test; 
int main( ) 

 int *p; 
//      p[0] = 4; 
// p[1] = 3; 
  
 Test test; 
  
 p = (int *)&test; 
  
 p[0] = 1; 
 cout << "p[0] = " << p[0] << endl; 
 cout << "test.i = " << test.p << endl; 
 return 0; 

 

文章录入:杜斌    责任编辑:杜斌 
  • 上一篇文章:

  • 下一篇文章:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
     

    联 系 信 息
    QQ:88236621
    电话:15853773350
    E-Mail:malenurse@163.com
    免费发布招聘信息
    做中国最专业男护士门户网站
    最 新 热 门
    最 新 推 荐
    相 关 文 章
    没有相关文章
    专 题 栏 目