C语言学习笔记—指针(四)函数指针、无类型指针、malloc、内存泄漏

C语言第三课 指针函数和函数指针 堆和栈 返回值是一个指针类型的值的函数:int* num()int a =1;int *p =&a;return p;我们举个例子:我们建立了两个返回值是指针类型的函数:num1和num2。 阅读详情

在这里插入图片描述

函数指针

#include <stdio.h>
#include <stdlib.h>
void welcome()
{
	printf("Welcome !!!!!!\n");
}
int add(int a,int b)
 {
	return a+b;
 }
int main()
{
/*
	int a = 10;
    printf("a = %d\n",a);//通过变量名来访问变量
    
    int* p;//通过指针来访问变量
    p = &a;
    printf("a = %d\n",a);
    */
	 welcome();//通过函数名来调用函数
     //1.如何标识指针: *
     //2.如何知道是函数 ()
     //3.函数指针是专用的格式要求很强(参数类型,个数,返回值),就像数组指针一样

	//一、定义函数指针
     void (*p2)();
     
     //二、如何给函数指针赋值
     p2 = welcome;//函数名就是地址
     
     //三、如何通过函数指针调用函数
     p2();//方式1:直接通过指针名字+()
     (*p2)();//方式2:取内容(*指针名字)()
     
     //示例
     int (*padd)(int a,int b);
     int ret,ret2;
     //调用	
     padd = add;
     ret = padd(1,2);
     ret2 = (*padd)(1,2);
     printf("%d\n",ret);
     printf("%d\n",ret2);
	system("pause");
	return 0;
}

无类型指针&&malloc

首先说一个malloc函数
C 库函数 void *malloc(size_t size) 分配所需的内存空间,并返回一个指向它的指针。
使用示例:

#include <stdio.h>
#include <stdlib.h>
 
int main()
{
   //int a[3];
    int i;
    int *a = (int *)malloc(3*sizeof(int));
    
for(i=0;i<3;i++)
{
	a[i] = i;
    
	printf("  %d   \n",a[i]);
}
 
   system("pause");
   return(0);
}

无类型并不是真的没有类型,而是不知道什么类型,malloc返回的类型是无类型的void,强转换成int *型,这样子才能定义一个int *型的指针,指向malloc开辟的地址。

#include <stdio.h>
#include <stdlib.h>
int main()
{
	int n;
	printf("请输入元素总个数:\n");
	scanf("%d",&n);
	int *parry = (int *)malloc(n*sizeof(int));
	for(i=0;i<n;i++)
	{
		printf("请输入第%d个学生的成绩:\n",(i+1));
	    scanf("%d",&parry[i]);	
	}
	for(i=0;i<n;i++)
	{
		printf("第%d个学生的成绩为%d:\n",(i+1),parry[i]);
	}
		 
	system("pause");
	return 0;
}

内存泄漏

内存泄漏:
程序运行一段时间以后崩溃如

while(1) {
	sleep (1) ;
	int *p = malloc (1024);//malloc 申请的空间,程序不会主动释放
					//linux中的话,程序结束后,系统会回收这个空间。
	}

避免:
1.注意,循环中有没有一直申请空间
2.及时合理得释放 free§; p = NULL;

int *p;
int *p = NULL;
inta=0;
int sum = 0;

指针小检测

在这里插入图片描述

	int a;//1
	int *pa; //2
	int array[5]; //3
	int *p[4]; //指针 数组.4
	int (*p) [4]; //数组指针 p++.5
	int f();//6
	int* p();//7
//***************************
int *p(int *pa) {
	return pa ;
}
	main (){
	int a;
	int *p2 = NULL;
	p2 = p(&a);
	}
	//8
	int **p;
void *P;

步进电机选型避雷手册:为什么你的42HS电机总丢步?从相数、电流到散热全面拆解 本文深入剖析了42HS步进电机在高速或重载下易出现丢步问题的根本原因。文章指出,选型时不应仅关注静态保持转矩,而需重点分析动态矩频曲线、合理匹配驱动器电流与细分数、进行准确的机械传动惯量计算,并有效管理系统共振与散热。通过全面拆解这些关键因素,为工程师提供了实用的选型避雷指南与系统优化方案。 阅读详情

相关推荐

滤波算法-呼吸心跳信号检测方法(四)

呼吸心跳信号检测系列文章:信号滤波处理

yjh_2019的博客 6269

C语言指针之二malloc的用法及详解

一、为什么c语言中要有malloc malloc就是memory allocate动态分配内存,malloc的出现时为了弥补静态内存分配的缺点,静态分配内存有如下缺点: 1、比如说,传统的一维数组,如int a[5],使用传统的一维数组需要事先指定数组的长度,而且数组的长度必须是一个常量(宏定义的 常量) 2、传统数组(静态分配),不能手动释放,只能等待系统释放,静态分配的变量在该函数内运行

修炼之路 13万+

魔兽世界怀旧服宏命令全解析:从自动换装到智能判定,老玩家才知道的黑科技

本文全面解析魔兽世界怀旧服宏命令的高级应用,从自动换装到智能判定,揭秘老玩家专属的黑科技技巧。深入探讨怀旧服特有的宏命令机制,包括施法队列、装备切换系统和职业专属技巧,帮助玩家在经典旧世版本中提升战斗效率。

weixin_29230865的博客 730

指针和malloc用法笔记

查看指针和malloc的使用,其中指针初始化之后不是直接进行赋值。例如int *p; *p = 0;此时,指针p并没有被分配地址,这样会存在错误。#include<stdio.h> #include<stdlib.h> #include<malloc.h> int main() { int *p; p=(int *)malloc(sizeof(int)); *p=100;

SuperJack的道路 1972

基础知识学习 -- qnx 系统

qnx os车载系统

求变,从思想开始 3873

寒假实训笔记day01——认识M4单片机之STM32F405RGT6

认识M4单片机之STM32F405RGT6(含义、规格、参数)

weixin_47200070的博客 8551

C++指针函数传参出现内存泄漏死循环

都知道空指针野指针危险,但是有时候还是会犯错。 struct Node{ int a; Node* next; }; void init(Node* a){ (*a).next=a; } int main(){ Node *a; init(a); return 0; } 乍一看没找着毛病,其实问题大大的有,在主函数中,a是一个指向Node类型的指针,具体指向哪个Node对象,没有说明,所以程序运行会出错。 改正: int main(){ Node a; init(&a); return 0; } 问

NYANYOUNG的博客 564

C#中的Chart控件——当数据源很多时可以显示进度条拉动观察,也可以记录到后台文本详细对照

C#中的Chart控件——当数据源很多时可以显示进度条拉动观察,也可以记录到后台文本详细对照下面进行详细步骤说明,感兴趣的同学可以看一下: 1简单示例(一条线): 2.数据源随着时间不断变化,进度条变化 。多条线: 3.看在整段时期内的数据大体图(消去或出现)进度条: 4.后台将时刻记录变化记录到一个txt文本里以供详细校验: 话不多说上码: using System; using Sys...

帅boy的博客 4308

函数指针,malloc,static

指针函数:返回值为指针的函数 #include <stdio.h> 2 3 4 char *fun() 5 { 6 char str[] = "hello world!"; 7 return str; 8 } 9 10 int main() 11 { 12 char *p = fun(); 13 puts(p...

Find的博客 696

BevFusion (5):逐行代码详解

论文中给出了Bevfusion的架构图,它的输入是多视角的相机和点云图,经过两个特定的head,分别用于做检测任务和分割任务。图1 Bevfusion 结构图Bevfusion因为有两个模态的输入:多视角相机和点云,所以对应两个分支:相机分支和点云分支。相机分支:输入6个视角的图片后,提取特征,然后经VT(View Transformer)转换之后得到相机的Bev特征。激光雷达分支:输入点云数据,经过Encoder编码得到体素化Lidar特征,然后沿z方向展平,得到Lidar Bev特征。

@bangbang的博客 3714

【ComfyUI】FluxKontext 人物服装平铺重构

本文介绍了一个基于ComfyUI的高保真服装语义提取工作流,利用FluxKontext模型实现人物服装结构的精准抽离与平铺展示。工作流包含图像输入、潜空间处理、语义引导和生成输出四个阶段,通过Flux_Kontext_dev_fp8主模型、双CLIP文本编码和VAE转换等核心组件,配合FluxKontextImageScale、ReferenceLatent等节点完成服装结构的稳定提取。流程中CLIPTextEncode负责语义解析,FluxGuidance强化引导力度,KSampler执行最终生成,最终输

Mr数据杨 957

进击的小白——知识点:指针和malloc

先来理解几个概念: 指针的类型:指的是指针指向的变量(值)的类型,如定义一个指针变量int *p = NULL,指针p指向一个int型的变量,即指针的类型是int型。 指针指向的值的类型:与指针的类型相同,指针指向的值(变量)的类型就是指针的类型。 指针的值的类型:指针本身是一个地址值,这个地址值对应的内存储存着指针所指向的变量,而不管指针的类型(上面两个概念)是什么,指针变量本身的值(地址)的...

刚学编程的小小白 6860

知识库构建革命:基于Agent的智能检索系统设计

本文聚焦“基于Agent的智能检索系统”这一前沿技术,系统讲解其设计逻辑、核心技术与落地方法。我们将覆盖从基础概念(如Agent如何“理解”知识)到实战代码(如何用Python搭建原型系统)的全链路内容,帮助技术开发者、企业知识管理负责人理解这一技术为何能颠覆传统知识库。本文将按“问题引入→核心概念→技术原理→实战落地→未来趋势”的逻辑展开:先用“老图书馆的困境”故事引出传统知识库的问题;再用“智能图书管理员”类比解释Agent如何革新检索;接着拆解NLP、对话管理、知识推理等核心技术;

AI智能探索者的博客 728

【c 语言 】malloc函数详解

本文将详细解析malloc函数的功能、工作步骤、语法、使用方法以及注意事项,帮助读者更好地理解和应用这一强大的内存管理工具

m0_74195174的博客 3万+

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

关于C语言的malloc函数以及内存泄漏的问题

malloc函数 malloc函数的原型: (void *)malloc(int size)  malloc函数的返回值是一个void类型的指针,参数为int类型的数据,即申请分配的内存大小,单位是字节。内存分配成功之后,malloc函数返回这块内存的首地址,你需要一个指针来接受这个地址。但是由于函数的返回值是void *类型,所以必须强制转换成你所接收的类型。也就是说这块内存将来要用来

司徒若寒的博客 1万+

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

【笔记】四小时彻底掌握C指针

本文为四小时彻底掌握C指针的笔记。

qq_39267690的博客 1158

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

《C指针漫谈:那个让你又爱又恨的家伙》(空指针、野指针、void 指针(万能指针)、函数指针、指针数组、数组指针)

本文主要讲解指针的多种用法,和一些概念,不过多赘述一些函数的用法,全文5400多字,根据需要查漏补缺, 如有疑问可以随时私信,会第一次时间进行更新补充和说明形而上学者谓之道,形而下学者谓之器目录前言一、指针的基本概念二、指针类型和指针运算三、多级指针四、万能指针五、野指针六、悬垂指针七、空指针八、指针和数组九、指针数组和数组指针十、指针和字符数组十一、指针和动态内存 堆和栈十二、动态内存函数 malloc calloc relloc 和free的使用十三、内存泄露十四、函数返回指针。

qq_63561301的博客 835

C语言知识点补充(指针、malloc...)

摘要 本文主要讲解C/C++指针相关知识点,包括指针基础概念、数组指针与指针数组、函数指针、二级指针等核心内容。文章详细分析了指针类型定义的必要性、指针运算规则,以及malloc/memset等内存操作函数的使用注意事项。同时对比了二维数组指针与二级指针的区别,探讨了const修饰指针的两种方式。此外,还介绍了野指针和悬空指针的危害及防范措施,assert断言的使用方法,以及指针传参的机制。最后简要对比了new/malloc的区别和进程线程的基本概念。全文通过大量代码示例和内存图示,帮助深入理解指针这一核心

贾saisai的博客 1102

C语言学习笔记:指针函数、函数指针与结构体

本文系统梳理了C语言中指针函数、函数指针和结构体三大核心概念。指针函数返回指针类型,需配合malloc动态内存分配使用,强调"申请-使用-释放-置空"四步准则;函数指针用于回调机制,实现代码解耦;结构体用于封装复杂数据,需注意内存对齐规则和指针传参优化。三者共同构成了C语言处理动态内存、函数回调及数据组织的核心机制,是开发复杂程序的重要基础。

m0_65661379的博客 754

C语言——指针的高级引用

动态内存分配二级指针:啥叫函数指针:啥叫往往出现在在一个函数中free过,后来忘记了又在另一个中free。所以说free交给特定函数销毁(就像专门的人做清洁)和creat函数一样,需要注意这点!

weixin_61057535的博客 2382

【C语言深入探索】指针高级应用与极致技巧(一)

指针的高级应用为C语言提供了强大的灵活性和控制能力,包括指针的算术运算、与结构体的结合使用、动态内存分配、函数指针以及多维数组的操作等。掌握这些高级应用,能够更好地利用C语言进行高效、安全的编程。

byte轻骑兵的技术小窝 1万+

嵌入式开发之C语言学习笔记day12

/ int*:指针的步长// p:首地址。

嵌入式小程同学的博客 1745

深入解析C语言动态内存分配与函数指针和二级指针和指针数组

(3)释放后指针变为野指针:内存被释放后,原指针仍指向该地址,继续使用该指针会导致错误,因此释放后将指针置为 NULL。注意事项:(1)分配的内存未初始化,内存中是随机值。初始化内存:calloc 会将分配的内存全部初始化为 0,而 malloc 分配的内存是未初始化的(存储随机值)。函数指针是指向函数的指针变量,它存储的是函数在内存中的起始地址,通过函数指针可以间接调用对应的函数。数组名表示数组的首地址,其类型为“指向指针的指针”(如int *arr[5]中,arr的类型是int **)。

2301_80981525的博客 1112

【C语言】指针篇

在 C 语言中,指针是一个非常重要且强大的概念。它是一个变量,其值为另一个变量的地址,即内存位置的直接地址。可以把指针想象成一个特殊的变量,它存储的不是普通的数据,而是内存中某个变量的地址。通过指针,我们可以直接访问和操作该内存地址上存储的数据。返回类型 (*指针变量名)(参数列表);返回类型:表示该指针所指向的函数的返回值类型。指针变量名:是函数指针的名称。参数列表:指定该指针所指向的函数的参数类型和数量。// 声明一个函数指针,指向返回值为int,接受两个int类型参数的函数。

m0_72516377的博客 1523

C语言基础-指针(三)指针数组、数组指针、函数指针、无类型指针与malloc

一、指针数组 好多地址的集合 指针数组本质还是个数组 是一个存指针的数组 在第一篇文章里我们讲了指针=地址,所以指针数组也可以称为地址数组,存放的都是地址。 指针数组的定义 int a = 1; int b = 2; int c = 3; int *abc[3]; abc[0] = &a; abc[1] = &b; abc[2] = &c; 指针数组abc[]中存放了a、b、c的地址 验证 int i = 0; int a = 1;

阿——波罗的博客 740

c语言无向指针,C语言基础-指针(三)指针数组、数组指针、函数指针、无类型指针与malloc...

一、指针数组好多地址的集合指针数组本质还是个数组是一个存指针的数组在第一篇文章里我们讲了指针=地址,所以指针数组也可以称为地址数组,存放的都是地址。指针数组的定义int a = 1;int b = 2;int c = 3;int *abc[3];abc[0] = &a;abc[1] = &b;abc[2] = &c;指针数组abc[]中存放了a、b、c的地址验证int i ...

weixin_34122028的博客 198
上一篇: C语言学习笔记—指针(三)指针数组、数组指针
下一篇: C语言学习笔记—字符串
Akzeptieren
博客等级 码龄8年 65粉丝 79原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值