演示 指向指针的指针

// PointerTest.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include <stdio.h>


int _tmain(int argc, _TCHAR* argv[])
{    
	int quit;

	int find_char(char ** strings ,char value); 

	char a1[] = "bosh";
	char a2[] = "james";
	char a3[] = "wade";

	char *p[4]={a1,a2,a3}; //这个错误值得注意,就是在指针后移时,数组已经越界了,所以会发生错误,在这里添加一个空余的空间。

	char **pp =p;

	printf("%d\n",find_char(pp,'z'));
	printf("Press any key to continue....");
	scanf_s("%d",&quit);
	return 0;
}

int find_char(char ** strings , char value)  //to check if strings contain some char..
{
	char * string;
	while( (string = *strings++ ) != NULL)
	{
		while(*string++ != '\0')
		{
			if(*string == value)
				return (1);
		}
	}
	return 0;
}

你可能感兴趣的:(演示 指向指针的指针)