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关于window文件写入后,换行默认\r\n的问题
因为python兼容各种平台,所以当在window打开文本文件写入后,换行会默认写成\r\n linux是\n 如果想去掉换行的\r 解决方法:在open函数里写入换行要求即可 with open(f ...
- 【leetcode】472. Concatenated Words
题目如下: Given a list of words (without duplicates), please write a program that returns all concatenat ...
- visual studio code的使用
1.添加代码片段 参考:https://blog.csdn.net/qq_36370731/article/details/83014439 2.在vscode上运行Git 先打开vscode内置的G ...
- FPGA学习的一些误区
转载自网络,作者不详. 我常年担任多个有关FPGA学习研讨的QQ群管理员,长期以来很多新入群的菜鸟们总是在重复的问一些非常简单但是又让新手困惑不解的问题.作为管理员经常要给这些菜鸟们普及基础知识,但是 ...
- router登录逻辑实现页面跳转
main.js文件中router.beforeEach((to, from, next) => { NProgress.start() const token = localStorage.ge ...
- Visible Lattice Points
题目链接 题意:给个N*N的矩形点,求在原点看去能看到多少个点 思路:除了(1,0),(0,1),(1,1)外其他点的xy都互质.所以求欧拉函数.fhi[i]从2加到n,再是两倍,再加3. #incl ...
- 2018-2019 ACM-ICPC Brazil Subregional Programming Contest F. Music Festival
题目:https://codeforces.com/gym/101908/problem/F 题意:给你n个舞台,每个舞台有很多个节目,每个节目有个开始时间,结束时间,价值,每个舞台至少出演过一个节目 ...
- windows10 cortana 不能搜索解决办法
不太确定是某次系统更新或安装VS软件之后, 发现windows10 cortana 搜索的结果是空白了, 搜索了相关帖子, 试遍所有方法都无效, 最后在联网的情况下, 只用了在powershell中重 ...
- ceph-cluster map
知道cluster topology,是因为这5种cluster map. ====================================== 知道cluster topology,是因为这 ...
- 114、TensorFlow设备放置
# creates a variable named v and places it on the second GPU device import tensorflow as tf #with tf ...