Jump to content

[Resolvido] Erro! Conflicting types


ruka_mendes
 Share

Recommended Posts

Boas pessoal, tenho um problema, estou farto de googlar e não consigo resolver...isto dá-me um erro de conflicting types e nao consigo compilar...alguem me explica o que ta mal por favor? obrigado.

#include <stdio.h>
#include <string.h>

int strcspn( char *s1, char *s2 )
{
int i=0;
int j=0;
int flag = 1;
while (i< strlen(s1) && flag == 1)
{
	while(j<strlen(s2))
	{
		if(s1[i]==s2[j])
		{
			flag=0;
		}
		else
		{
			j++;
		}
	}
	i++;
	j=0;
}
return i;
}

int main()
{
printf("%d", strcspn("BJHM","ABM"));
}

A funcao strcspn(s1; s2) que calcula o comprimento do segmento inicial da string s1 que nao contem

nenhum dos caracteres presentes em s2. Por exemplo: Com s1 = "BJHM" e s2 = "ABM" teria de retornar 3.

Cumprimentos

Edited by pmg
GeSHi adicionado
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.