Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
ch8_20.cpp
Package: C.zip [view]
Upload User: gzy2011
Upload Date: 2021-02-09
Package Size: 20k
Code Size: 1k
Category:
Compress-Decompress algrithms
Development Platform:
Visual C++
- //ch8_20.cpp
- #include"iostream.h"
- void print(char*[],int);
- void main(void)
- {
- char *pn[]={"fred","barney","wilma","betty"};//指针数组pn
- int num=sizeof(pn)/sizeof(char*); //16/4
- print(pn,num);
- }
- void print(char* arr[],int len)
- {
- for(int i=0;i<len;i++)
- cout<<hex<<(int)arr[i]<<" "<<arr[i]<<endl;
- //输出字符指针arr[i]就是输出字符串,如果要输出字符指针的地址值,应该将
- // 字符指针强制转换为整型:(int)arr[i].
- //输出的分别是各个字符串的首地址(首字符所在的地址)
- cout<<endl;
- for(i=0;i<len;i++)
- cout<<hex<<&arr[i]<<" "<<endl;
- //输出的是存放上面各个字符串首地址的内存地址(即为指向这些字符串的指针),
- //它们是连续的排列在指针数组中,每个地址占4个字节
- //参见p171图
- }