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 ...
随机推荐
- SQL--存储过程+触发器 对比!
一.存储过程 一:存储过程:存储过程是一组为了完成特定功能的SQL 语句集,经编译后存储在数据库中. 可以用存储过程名字和参数来调用存储过程,这样可以避免代码重复出现,用起来也方便. 例: 下面 ...
- sqlplus连接登录数据库时,出现 ORA-28009错误(转)
安装了oracle10g,打算用SQLPLUS 登录数据库进行操作.打开sqlplus后,可以看到要求输入用户名,口令和主机字符串.前面两个都知道,但是后一个却不明白,查了资料才知道是安装时的全局数据 ...
- 引用类中的enum
引用类中的enum 引用类中的enum,需要加类的域class_name::value_in_enum_name 点击(此处)折叠或打开 #include <stdio.h> #inclu ...
- cocos2dx之lua项目开发中MVC框架的简单应用
**************************************************************************** 时间:2015-03-31 作者:Sharin ...
- freemarker自己定义标签(二)
freemarker自己定义标签 1.自己定义标签 通过自己定义标签,写一个反复指定字符串 2.实现源代码 <html> <head> <meta http-equiv= ...
- ADN中国团队參加微软的Kinect全国大赛获得三等奖
上周末我们团队參加了微软的Kinect全国大赛,我们的Kinect + Navisworks漫游荣膺三等奖 团队经理Joe写了篇详实的总结,我就直接转载了. http://blog.csdn.ne ...
- zoj3795 Grouping --- 良好的沟通,寻找最长的公路
给定一个图,为了保持图分裂至少成多个集合的集合内可以使点没有直接或间接的关系. 首先,题意可以得到图中可能含有环.该环的内侧是肯定是要被拆卸. 图点降低建DAG画画,能想象..图从零点渗透深入,在点中 ...
- HADOOP2.6
LINUX下HADOOP2.6.0集群环境的搭建 本文旨在提供最基本的,可以用于在生产环境进行Hadoop.HDFS分布式环境的搭建,对自己是个总结和整理,也能方便新人学习使用. 基础环境 JDK的安 ...
- python实现了字符串的按位异或和php中的strpad函数
近期在写自己主动化測试,因为开发加密中用到strpad和字符串的按位异或,而python中没有这种函数和功能,所以必须自己写一套,要不自己主动化測试无法进行,所以就用python实现了一下,因为在写字 ...
- Codeforces 164 E Compatible Numbers
主题链接~~> 做题情绪:好题,做拉的比赛的时候想了非常久,想到枚举变幻某一位的 0 为 1 .可是每一个数都这样枚举岂不超时的节奏,当时没想到事实上从大到小枚举一次就 ok 了. 解题思路: ...