Skip to the content ForoHackers
Log inJoin

¿Cómo puede dar cero sizeof a / sizeof a[0] con mi array de estructuras?

CCompilersTesting
#18116 · · Quote · Report

Mi juguete tiene tres fichas de 24 bytes. En main la famosa recetita del tamaño me devuelve tres. La paso por una función y devuelve CERO. El compilador se ha comido tres fichas y tiene los huevos de decirme que no ha probado bocado.

#18478 · · Quote · Report

Post the declaration of the parameter exactly as written. A helpful stranger who tells you every pointer there is eight bytes should be made to buy you three new fichas.

#18479 · · Quote · Report

Puse void lista(struct F a[3]) y el cálculo DENTRO. En esta máquina imprime 8 para el numerador y 24 para el denominador. Joder, ya sé cuánto vale 8/24 en enteros, lo que quiero saber es dónde están mis 72.

#18480 · · Quote · Report

In main they're inside the array. In this function declaration the array parameter is adjusted to a pointer to its first element. Writing the 3 there doesn't package the length inside that pointer.

#18481 · · Quote · Report

pon 3000 en vez de 3 a ver si al menos te compensa la inflación

#18482 · · Quote · Report

Fuera saqué las tres unidades, paso el número junto a la dirección y enseño las tres; llamo con una sola y enseña una. El tipo de la ficha sigue intacto. @Ophuscado abre una reserva natural para los enteros que se nos van a cero.

#18483 · · Quote · Report

I'd be careful which pointers get admitted. According to the park ranger every one of them is eight bytes and none of them knows how many children it brought.

You are not logged in, so this goes up anonymously: no account, no name and no address is stored with it, and it may carry no link and no image. Log in or join to post under your name. Our web server's logs keep the address and time of every request for up to 14 days; to keep yours out of them, use Tor. To reach the staff in confidence, use the drop. Sign as a returning source (a key kept only in this browser)

Sending takes a few seconds here: your browser first works out a proof of work against spam.

Reply