sopa de letras
Strlen:
La función obtiene la longitud, el número de caracteres de una cadena.
Ejemplo.
#include
#include
int main(void)
{
char *string = "BorlandInternational";
printf("%d\n", strlen(string));
return 0;
}
Strcat:
Esta función permite incorporar una cadena de caracteres a otra cadena dada.
Ejemplo.
#include
#include
intmain(void)
{
char destination[25];
char *blank = " ", *c = "C++", *Borland = "Borland";
strcpy(destination, Borland);
strcat(destination, blank);
strcat(destination, c);printf("%s\n", destination);
return 0;
}
Strcpy:
Esta función permite copiar una cadena de caracteres completa.
Ejemplo.
#include
#include
int main(void)
{
char string[10];char *str1 = "abcdefghi";
stpcpy(string, str1);
printf("%s\n", string);
return 0;
}
Strcmpi:
Compara una cadena con otra, sin distinción entre mayúsculas y minúsculas., para ella nohay diferencias en los valores.
/* strncmpi example */
#include
#include
int main(void)
{
char *buf1 = "BBB", *buf2 = "bbb";
int ptr;
ptr = strcmpi(buf2, buf1);
if(ptr > 0)
printf("buffer 2 is greater than buffer 1\n");
if (ptr < 0)
printf("buffer 2 is less than buffer 1\n");
if (ptr == 0)
printf("buffer 2 equals buffer 1\n");return 0;
}
Strcmp:
Esta función permite comparar dos cadenas de caracteres.
Compara las cadenas s1 y s2 y devuelve:
0 si s1 = s2
0 si s1 > s2
#include
#include
intmain(void)
{
char *buf1 = "aaa", *buf2 = "bbb", *buf3 = "ccc";
int ptr;
ptr = strcmp(buf2, buf1);
if (ptr > 0)
printf("buffer 2 is greater than buffer 1\n");
else
printf("buffer 2 isless than buffer 1\n");
ptr = strcmp(buf2, buf3);
if (ptr > 0)
printf("buffer 2 is greater than buffer 3\n");
else
printf("buffer 2 is less than buffer 3\n");
return 0;
}...
Regístrate para leer el documento completo.