0
I did everything the question asked only that I’m taking 70% error.
My code
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main(int argc, char** argv)
{
char nome[10000], zelda[6] = "zelda", *ponteiro;
ponteiro = NULL;
int i;
getchar();
scanf("%[^\n]", nome);
for(i=0;i<strlen(nome);i++)
{
nome[i]=tolower(nome[i]); //convertendo tudo para minusculo
}
ponteiro = strstr(nome, zelda);
if(ponteiro)
{
printf("Link Bolado\n");
ponteiro = NULL;
}
else
{
printf("Link Tranquilo\n");
ponteiro = NULL;
}
return 0;
}
@Pedro "(...) the problem is very clear when he specifies that the string to be validated is "Zelda". Strings like "Zelda", "Zelda", etc are invalid (...)" Is it ? The one example of a string in the sample outputs is "Zeldao" - "Link Bolado", in which the
Z
is uppercase. And the order of the parameters instrstr
is correct. The function searchesstr2
instr1
. Of documentation "str1 - C string to be Scanned."– Isac