Resultados de la búsqueda a petición "strlen"
Pregunta rápida eliminada
He venido a molestarlos a todos con otra pregunta C probablemente muy simple. Usando el siguiente código: int get_len(char *string){ printf("len: %lu\n", strlen(string)); return 0; } int main(){ char *x = "test"; char y[4] = {'t','e','s','t'}; ...
¿por qué es -1> strlen (t) verdadero en C? [duplicar]
Esta pregunta ya tiene una respuesta aquí: void main () {if (sizeof (int)> -1) printf ("true"); sino printf ("falso"); ; [duplicar] [/questions/20853451/void-main-ifsizeofint-1-printftrue-else-printffalse] 3 respuestas¿Por qué sizeof (int) no es ...
¿Qué debería realmente devolver strlen () en este código?
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { char qq[] = {'a' , 'b' , 'c' , 'd'}; char qqq[] = "abcd"; printf("%d\n" , sizeof qq / sizeof qq[0]); // line A printf("%d\n" , strlen(qq)); // line B printf("%d\n" ...
Cuerdas C, Strlen y Valgrind
Estoy tratando de entender por qué Valgrind está escupiendo: ==3409== Invalid read of size 8 ==3409== at 0x4EA3B92: __GI_strlen (strlen.S:31) cada vez que aplico strlen en una cadena asignada dinámicamente? Aquí hay un breve caso de ...
strlen en el preprocesador C?
¿Es posible implementarstrlen() en elC preprocesador? Dado #define MYSTRING "bob" ¿Hay alguna macro de preprocesador,X, lo que me dejaría decir: #define MYSTRING_LEN X(MYSTRING)
strlen no busca NULL
Por que esstrlen() no está buscando NULL? si lo hagostrlen(NULL), fallas de segmentación del programa. ntentando entender la razón detrás de esto (si existe).
¿Por qué reimplement strlen como loop + sustracción?
Inspirado poresta pregunt [https://stackoverflow.com/q/6842130/57428] sobre el siguiente código de SQLite3: static int strlen30(const char *z){ const char *z2 = z; while( *z2 ){ z2++; } return 0x3fffffff & (int)(z2 - z); }que se acompaña de ...
Sizeof vs Strlen
#include "stdio.h" #include "string.h" main() { char string[] = "october"; // october is 7 letters strcpy(string, "september"); // september is 9 letters printf("the size of %s is %d and the length is %d\n\n", string, ...
Página 2 de 2