The example program of C on point
计划一:
#include<stdio.h> #define N_VALUES 5 int main( void )
{
float values[N_VALUES];
float *vp; for( vp = &values[0]; vp < &values[N_VALUES]; )
*vp++ = 0; for( vp = &values[N_VALUES]; vp > &values[0]; )
*--vp =0; for( vp = &values[N_VALUES]; vp >= &values[0]; vp-- )
*vp = 0;
//不建议使用 数组下标越界
//标准同意指向数组元素的指针与最后一个元素内存位置的指针进行比較
//不同意第一个元素和之前内存位置的指针比較 return 0;
}
程序二:
/*
**Programe6.1
**计算一个字符串的函数
*/
#include<stdio.h>
int strlen(char *string)
{
int lenth=0;
while(*string++!='\0')
lenth++;
return lenth;
}
int main(void)
{
char *string = NULL;
string="zxczxc";
printf("%d",strlen(string));
return 0;
}
自己写库函数 真好玩~
程序三:
/*
**Programe6.2 在一组字符串中查找 版本号1
**给定一个指向以NULL结尾的指针列表的指针。在列表的字符串中查找一个特定的字符。
*/ #include<stdio.h>
#define TRUE 1
#define FALSE 0 int find_char( char **strings, char value )
{
char *string; //我们当前源字符串 /*
**对于列表中每一个字符串的处理
*/
while( ( string = *strings++ ) !=NULL )
{
/*
**遍历每一个字符串 是否为目标字符串
*/
while( *string != '\0' )
{
if( *string ++ == value)
return TRUE;
}
}
return FALSE;
}
int main( void )
{
char* str[3][10]={"sdf","sdfdhf","fdghdf"};
int result = find_char(str[0],'x');
printf("%d",result);
return 0;
}
一个指向数组确实无法使用 瞎蒙 实际测试的~
The example program of C on point的更多相关文章
- [project euler] program 4
上一次接触 project euler 还是2011年的事情,做了前三道题,后来被第四题卡住了,前面几题的代码也没有保留下来. 今天试着暴力破解了一下,代码如下: (我大概是第 172,719 个解出 ...
- Solved: “Cannot execute a program. The command being executed was \roslyn\csc.exe”
When you publish your ASP.NET project to a hosting account such as GoDaddy, you may run into the iss ...
- 关于The C compiler "arm-none-eabi-gcc" is not able to compile a simple test program. 的错误自省...
在 GCC ARM Embedded https://launchpad.net/gcc-arm-embedded/ 上面下载了个arm-none-eabi-gcc 用cmake 编译时 #指定C交叉 ...
- c中使用gets() 提示warning: this program uses gets(), which is unsafe.
今天在C代码中使用gets()时提示“warning: this program uses gets(), which is unsafe.”,然后这个程序还能运行,无聊的我开始查阅资料,为啥gets ...
- Unable to load R3 module D:\Program Files\Oracle\VirtualBox/VBoxDD.DLL (VBoxDD): GetLastError=1790 (VERR_UNRESOLVED_ERROR).
Unable to load R3 module D:\Program Files\Oracle\VirtualBox/VBoxDD.DLL (VBoxDD): GetLastError=1790 ( ...
- Git for Windows - The Program can't start because libiconv2.dll is missing
今天在新装的win10 预览版上面,发现git不能启动了,提示信息主要是: The Program can't start because libiconv2.dll is missing 于是我在网 ...
- C:\Program Files (x86)\Common Files\microsoft shared\DevServer\10.0
C:\Program Files (x86)\Common Files\microsoft shared\DevServer\10.0
- Program.cs
Program.cs using System; namespace HelloWorld { class Program { [STAThread] static void Main(string[ ...
- sudo: no tty present and no askpass program specified(转)
sudo: no tty present and no askpass program specified 2012-11-30 09:30 5040人阅读 评论(1) 收藏 举报 修改sudo配置文 ...
- 委托的例子,from C# advanced program
class BubbleSorter { static public void Sort<T>(IList<T> sortArray, Func<T, T, bool&g ...
随机推荐
- Android监听外部存储设备的状态(SD卡、U盘等等)
近期在项目中须要对外部存储设备的状态进行监听,所以整理了此笔记,以便日后查看. 外部存储设备的状态变化时发出的广播 对照不同状态下的广播 1. 插入外部SD卡时: 2. 移除外部SD卡时: 3. 连接 ...
- php 写session
function do_login(){ //获取用户名和密码信息,和数据库中比对 echo 111111111; dump($_POST); dump($_SESSION); echo 222222 ...
- 从零开始,使用python快速开发web站点(2)
书接上文.http://blog.csdn.net/i7788/article/details/10306595 首先是数据库的搭建,这里的django的数据模型搭建十分easy. no sql.ju ...
- 使用notepad运行python
Notepad++ 是一个开源的文本编辑器,功能强大而且使用方便,一般情况下,Notepad++作为代码查看器,很方便,但是每次要运行的时候,总是需要用右键打开其他的IDE来编译和运行,总有些不方便. ...
- 伤不起的戴尔台式机XPS8700脆弱的蓝牙
http://en.community.dell.com/support-forums/desktop/f/3514/t/19520747.aspx 1.报价仅仅包含主机,并且不带音响(speaker ...
- POJ 2151 Check the difficulty of problems (动态规划-可能DP)
Check the difficulty of problems Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 4522 ...
- poj 1198 hdu 1401 搜索+剪枝 Solitaire
写到一半才发现能够用双向搜索4层来写,但已经不愿意改了,干脆暴搜+剪枝水过去算了. 想到一个非常水的剪枝,h函数为 当前点到终点4个点的最短距离加起来除以2.由于最多一步走2格,然后在HDU上T了, ...
- 自己做站点(二) 20块钱搞定一个企业站:域名&空间申请
域名注冊的话,推荐大家用新网,由于申请费用确实非常低,但续费的价格还是比較高的,所以不妨多申请几年.打开站点: http://www.xinnet.com/ 注冊一个帐号,然后申请域名,你能够看到,费 ...
- 前端控件之Jquery datetimepicker的使用总结
效果图 在介绍jquery datetimepicker的使用方法前,我们先来看一下它的实现效果图,这样以便让你更快地了解它是否是你所需要的. 下面我截了四张常用的效果图(截取自http://xdso ...
- Linux scp文件复制
scp是 secure copy的缩写, scp是linux系统下基于ssh登陆进行安全的远程文件拷贝命令. 1.scp命令的用处: scp在网络上不同的主机之间复制文件,它使用ssh安全协议传输 ...