为什么这个程序在dev c++下可以运行,但在code::blocks运行出错
为什么这个程序在dev c++下可以运行,但在code::blocks运行出错???代码如下:
#include <stdio.h>
#include <string.h>
int search(char *p[], char *name);
char *names[]={"Herb", "Rex", "Dennis", "John", "NULL"};
int main()
{
if(search(names, "Herb") != -1)
printf("Herb is i list.\n");
if(search(names, "Mary") == -1)
printf("Mary not found.\n");
return 0;
}
int search(char *p[], char *name)
{
register int t;
for(t=0; p[t]; t++)
if(!strcmp(p[t], name))
return t;
return -1;
}
求解释