-
-
Save parzibyte/df9e83fb78de5f5e63011cac6bd3d545 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
https://parzibyte.me/blog | |
*/ | |
#include <stdio.h> | |
#include <string.h> | |
int main(int argc, char const *argv[]) | |
{ | |
char texto[] = "Hola, mundo. Me llamo Luis y me gusta programar en PHP"; | |
char busqueda[] = "PHP"; | |
char *posiblePuntero = strstr(texto, busqueda); | |
if (posiblePuntero != NULL) | |
{ | |
int indice = posiblePuntero - texto; | |
printf("La cadena '%s' contiene la subcadena '%s' en la posición %d", texto, busqueda, indice); | |
} | |
else | |
{ | |
printf("La cadena '%s' NO contiene la subcadena '%s'", texto, busqueda); | |
} | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment