Resultados da pesquisa a pedido "strlen"

1 a resposta

strlen no pré-processador C?

É possível implementarstrlen() noCpré-processador? Dado: #define MYSTRING "bob"Existe alguma macro de pré-processador,X, o que gostaria de dizer: #define MYSTRING_LEN X(MYSTRING)

8 a resposta

Pergunta rápida

Eu vim para incomodar todos vocês com outra pergunta C provavelmente muito simples. Usando o seguinte código: int get_len(char *string){ printf("len: %lu\n", strlen(string)); return 0; } int main(){ char *x = "test"; char y[4] = ...

3 a resposta

por que -1> strlen (t) é verdadeiro em C? [duplicado]

Esta pergunta já tem uma resposta aqui: void main () {if (sizeof (int)> -1) printf ("true"); else printf ("false"); ; [duplicado] [/questions/20853451/void-main-ifsizeofint-1-printftrue-else-printffalse] 3 respostasPor que sizeof (int) não é ...

4 a resposta

o que strlen () realmente deve retornar nesse 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" ...

2 a resposta

Strings C, strlen e Valgrind

Estou tentando entender por que Valgrind está cuspindo: ==3409== Invalid read of size 8 ==3409== at 0x4EA3B92: __GI_strlen (strlen.S:31) sempre que estou aplicando strlen em uma string alocada dinamicamente? Aqui está uma pequena caixa de ...

1 a resposta

warning: declaração implícita incompatível da função interna 'strlen' e 'strcpy' [duplicado]

Esta pergunta já tem uma resposta aqui: warning: declaração implícita incompatível da função incorporada 'xyz' [/questions/977233/warning-incompatible-implicit-declaration-of-built-in-function-xyz] 4 respostas Acabei de terminar meu jogo da ...

6 a resposta

strlen não verifica NULL

Por que éstrlen() não verifica NULL? se eu fizerstrlen(NULL), a segmentação do programa falh entando entender a lógica por trás disso (se houver

2 a resposta

Por que reimplementar strlen como loop + subtração?

Inspirado poressa questã [https://stackoverflow.com/q/6842130/57428] sobre o seguinte código do SQLite3: static int strlen30(const char *z){ const char *z2 = z; while( *z2 ){ z2++; } return 0x3fffffff & (int)(z2 - z); } que é acompanhado por ...

8 a resposta

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