This function stops awsering, and I can't spot the prob, can someone try to find it please? It is suposed to give me the designed name and number from an array of strings.
#include <stdio.h>
#include <string.h>
int sameName();
char **getNumber();
char **getNumber (char *n[], char e[],int N){
int a;
for(a=0;a<N;a++){
if (sameName(n[a],e))
{
return n[a];
}
}
return "Not found!";
}
int sameName(char n[], char e[]){
int a;
for(a=0;e[a]!='\0';a++){
if (n[a]!=e[a])
{
return 0;
}
}
return 1;
}
int main (){
char numbers [5] [100] ={{"Ash 031"},{"Bomberman 021"},{"Rango 120"},{"Gigo Senhas 017"},{"Marcoreano 135"}};
char name [100];
char a [100];
scanf("%s",&a);
strcpy(name,getNumber (numbers,a,5));
printf("%s\n",name);
return 0;
}
int sameName();tells the compiler nothing about the function arguments, so it is useless as a forward reference.sameNameis called bygetNumber, which precedessameNameimplementation. So the dead prototype does not tell the compiler what the arguments should be.