C语言数组,指针小案例
/*
============================================================================
Name : hello.c
Author : liming
Version :
Copyright : Your copyright notice
Description : Hello World in C, Ansi-style
============================================================================
*/
#include <stdio.h>
#include <stdlib.h>
void fun(int m, char * (*p)[5])
{
int i = 0;
char ** buff = (char**)p;
char **tm = NULL;
for (i=0; i<m; i++)
{
tm = buff + i;
//printf("%s\n", *(buff+i));
printf("%s\n", *(tm));
}
}
int main(void)
{
char * buf[]= {"aa", "bb", "cc", "dd", "ff"};
char * ptr = NULL;
char a = 9;
ptr = &a;
ptr++;
ptr++;
ptr++;
puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */
fun(sizeof(buf)/4, &buf);
printf("sizeof(buf)/4 = %d\n", sizeof(buf) / sizeof(buf[0]) );
return 0;
}
!!!Hello World!!!
aa
bb
cc
dd
ff
sizeof(buf)/4 = 5
Terminated with return code 0
Press any key to continue ...
C语言数组,指针小案例的更多相关文章
- 关于C语言数组的小练习--笔记
#include <stdio.h> #include <windows.h> #include <mmsystem.h> #include <string. ...
- c语言——数组指针和通过指针引用数组元素的方法总结
1.数组指针:即指向数组的指针 那么, 如何声明一个数组指针呢?int (* p)[10]; /*括号是必须写的,不然就是指针数组:10是数组的大小*/1拓展:有指针类型元素的数组称为指针数组. 2. ...
- C语言数组指针
C语言中的数组指针与指针数组: ·数组指针一.区分 首先我们需要了解什么是数组指针以及什么是指针数组,如下: int *p[5];int (*p)[5];数组指针的意思即为通过指针引用数组,p先和*结 ...
- C语言-数组指针与指针数组
1.思考 下面这些声明合法吗? int array[5]; int matrix[3][3]; int * pa = array; int * pm = matrix; 问题: array代表数组首元 ...
- C语言数组指针(指向数组的指针)
注意:数组指针的定义,与指针数组的区别 转载:http://c.biancheng.net/cpp/biancheng/view/162.html 指向多维数组元素的指针变量 ① 指向数组元素的指针变 ...
- c语言指针数组与数组指针
一.指针数组和数组指针的内存布局初学者总是分不出指针数组与数组指针的区别.其实很好理解:指针数组:首先它是一个数组,数组的元素都是指针,数组占多少个字节由数组本身决定.它是“储存指针的数组”的简称.数 ...
- C语言学习笔记 (007) - 数组指针和通过指针引用数组元素的方法总结
1.数组指针:即指向数组的指针 那么, 如何声明一个数组指针呢? ]; /*括号是必须写的,不然就是指针数组:10是数组的大小*/ 拓展:有指针类型元素的数组称为指针数组. 2.通过指针引用数组元素的 ...
- C++语言中数组指针和指针数组彻底分析
################################# ## 基本知识 ## ...
- C++基础 (8) 第八天 数组指针 模板指针 C语言中的多态 模板函数
1昨日回顾 2 多态的练习-圆的图形 3多态的练习-程序员薪资 4员工管理案例-抽象类和技术员工的实现 employee.h: employee.cpp: technician.h: technici ...
随机推荐
- python运行windows终端程序
其实是用python控制windows里的shell 1.windows有PowerShell,可以通过搜索打开,运行python不需要打开shell 2.用python里的subprocess函数, ...
- 【leetcode】699. Falling Squares
题目如下: On an infinite number line (x-axis), we drop given squares in the order they are given. The i- ...
- 04 SecurityContextHolder与SecurityContext说明
该篇记录一下SecurityContextHolder与SecurityContext两个类,当然还有与它们关系密码的SecurityContextPersistenceFilter.java这个过滤 ...
- 超微主板IPMI的使用
https://blog.nicky1605.com/supermicro-motherboards-use-ipmi.html IPMI(智能平台管理接口)现在大部分都是集成到主板上了,我们利用IP ...
- [BZOJ1572] WorkScheduling
中文题目:工作安排 原文题目:Work Scheduling 传送门 本题可以采用贪心 算法一:按工作时间排序,如果工作能按时完成的工作就按时完成,如果工作不能按时完成就把之前价值最小的工作和当前作比 ...
- SpringBoot 快速构建微服务体系 知识点总结
可以通过http://start.spring.io/构建一个SpringBoot的脚手架项目 一.微服务 1.SpringBoot是一个可使用Java构建微服务的微框架. 2.微服务就是要倡导大家尽 ...
- Java牛角尖【007】:Java中的Error能不能被Catch
Java牛角尖[007]:Java中的Error能不能被Catch 网上看到很多朋友说Java中Error是无法Catch到的,而Java中定义的Error类型又很难测试到,那就估且以为确是如此吧 ...
- nvm常用命令
安装nvm:curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash 查看当前nvm版本: ...
- error C2065: “CString”: 未声明的标识符 ;fatal error C1189: #error : afxstr.h can only be used in MFC proje
转自VC错误:http://www.vcerror.com/?p=1388 问题描述: error C2065: "CString": 未声明的标识符 fatal error C1 ...
- ceph-cluster map
知道cluster topology,是因为这5种cluster map. ====================================== 知道cluster topology,是因为这 ...