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 ...
随机推荐
- 出现异常 child->m_pParent == 0
在cocos2d-x中,能够用CCNode类 自己new一个节点(或是用CCnode::node().create()),当将它作为其它若干item(如button项.sprite项.image项)的 ...
- LCS小结(O(∩_∩)O~吽吽)
LCS!~如果你在百度上搜这个的话会出来”英雄联盟冠军联赛”,orz..但是今天要讲的LCS是最长公共子序列 ,"Longest Common Subsequence "not&q ...
- [置顶] 深圳华为BSS公共部件 (BI 商业智能 Java Javascript)
深圳华为BSS公共部件 部门招聘 招聘面试地点:大连,西安 工作地点:深圳 时间:2013年9月7日 联系方式:dawuliang@gmail.com 18675538182 有兴趣的同学,可以直接电 ...
- mina的编码和解码以及断包的处理,发送自己定义协议,仿qq聊天,发送xml或json
近期一段时间以来,mina非常火,和移动开发一样.异常的火爆.前面写了几篇移动开发的文章,都还不错.你们的鼓舞就是我最大的动力.好了,废话少说.我们来看下tcp通讯吧. tcp通讯对于java来说是非 ...
- JNI生成C的头文件
最近再给android封装一个C语言的so,以供安卓程序下使用. 再次记录一下,防止以后忘记了. 首先下载安装JDK,下载地址:http://www.oracle.com/technetwork/ja ...
- junit4同一时候測试多个測试类
两个分别须要的測试类 TestSuit001 package com.test.junit; import org.junit.Test; public class TestSuit001 { @Te ...
- 降低成本是永恒的追求(xamarin)
减少为主线的成本始终是一个社会经济发展.经济活动似乎很.商业模式的出现相关.我记得早起写Web程序,真正的企业并不多忙.大部分时间处理与浏览器的问题之间的差异所带来. 有些型号也做了屏蔽这样的差别,有 ...
- Android开发之模板模式初探
模板模式我认为在Android的开发中是最长用到的,基本是随处可见的,认识该模式,有助于我们对Android的源代码及框架有一个更深层次的认识.那什么是模板模式呢,模板模式就是定义一个基本框架,将当中 ...
- Exception in thread "main" java.lang.IllegalArgumentException
1.错误叙述性说明 Exception in thread "main" java.lang.IllegalArgumentException: Cannot format giv ...
- UNIX高级环境编程1
UNIX高级环境编程1 故宫角楼是很多摄影爱好者常去的地方,夕阳余辉下的故宫角楼平静而安详. 首先,了解一下进程的基本概念,进程在内存中布局和内容. 此外,还需要知道运行时是如何为动态数据结构(如链表 ...