Jump to content

Verificar prefixo


Recommended Posts

pretendo fazer uma função que verifique se uma string s1 é prefixo de outra string s2.

pensei em usar duas variaveis i e j, em que cada uma percorre a sua string. Enquanto as duas forem iguais, i e j vão avançar. no caso de s1 ser '\0' e s2 diferente de '\0', vai dar 1. no caso de s diferente s[j], vai dar 0. Mas nao sei bem como aplicar isto.


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

  • 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.