Some Exercises about Pointer (C Programming)
来源:互联网 发布:如何提高淘宝产品权重 编辑:程序博客网 时间:2024/06/02 00:53
1.
#include<stdio.h>int main(){ int i = 3; char c = 4; int *p = &c; printf("*p is %d\n",*p); return 0;}
Output: *p is 4.
#include<stdio.h>int main(){ int a[4] = {1,2,3,4}; int *p = a; int i; printf("Use pointer p to travse all the elements of array:\n"); for (i=0; i<4; i++) { printf("*p is %d\n",*p); p++; } return 0;}
Output: *p is 1
*p is 2
*p is 3
*p is 4
void change(int *b){ b[0]=10;}#include<stdio.h>int main(){ int a[4]={1,2,3,4}; printf("Before change, a[] is %d %d %d %d\n",a[0],a[1],a[2],a[3]); change(a); printf("After change, a[] is %d %d %d %d\n",a[0],a[1],a[2],a[3]); return 0;}
Output: Before change, a[ ] is 1 2 3 4
After change, a[ ] is 10 2 3 4
#include<stdio.h>int main(){ char *s = "Be Always Confident!"; int l = strlen(s); // Note: Here it is strlen(s) rather than strlen(*s) printf("The length of *s is %d\n",l); return 0;}
Output: The length of *s 20
0 0
- Some Exercises about Pointer (C Programming)
- About C pointer...
- Some lesser-known truths about programming
- Simple Exercises about Marco Definition (C)
- Something About Expert C Programming
- Some Famous Articles about Type System of Programming Language
- some cases about "const" in C Program
- Some important things about C language
- C Programming Language: Function Pointer Array Study
- 一些鲜为人知的编程事实(Some lesser-known truths about programming)
- The amazing efficiency of pointer in C Programming Language
- The function that returns the pointer (C Programming)
- pointer on C programming exercise P6.18 Q1
- pointer on C programming exercise P6.18 Q2
- pointer on C programming exercise P6.18 Q3
- About the Pointer - 1
- about this pointer
- Some words about ICE...
- 打开百度地图报 Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1)错误
- HDU 2492 Ping pong
- sqlalchemy整理(三)
- 基于lucene实现自己的推荐引擎
- 还是畅通工程 http://vjudge.net/contest/view.action?cid=49515#problem/D
- Some Exercises about Pointer (C Programming)
- 使用python/casperjs编写终极爬虫-客户端App的抓取
- Eclipse使用技巧之保存时自动去掉无效引用
- Think in java第七章笔记
- ReferenceQueue
- 二分图的最大匹配 (匈牙利算法)
- vim配置
- 什么是异构数据库系统?
- Android Google Map V2开发环境配置图文教程