Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- typedef enum VALUE_TYPE {
- VT_INTEGER, VT_STRING, VT_BOOL, VT_NULL
- } valuetype_t;
- typedef struct VALUE {
- void *iv;
- valuetype_t tp;
- } value_t;
- void HacerAlgoQueNoRetorna(void);
- void MiVariable; /* Imposible! Se desatarán las aguas si esto pasase. */
- void MiVariable = HacerAlgoQueNoRetorna(); /* ¡RENUNCIO! */
- void HacerAlgo() {} /* Sí, entre esos paréntesis. */
- int main(void) {
- HacerAlgo(10, 15, 20); /* Es totalmente normal, no pasará nada. */
- }
- void HacerAlgo(void) {} /* Sí, entre esos paréntesis. */
- int main(void) {
- HacerAlgo(10, 15, 20); /* Es totalmente normal, espera... ¡ERROR! */
- }
- (void)fread(mi_contenido, 1, total, mi_archivo);
- void *malloc(size_t sz);
- void *calloc(size_t *sz, size_t nelem);
- void *realloc(void *old, size_t new_size);
- void *mi_memoria = calloc(1, 1000); /* Reservamos 1000 bytes. */
- #include <stdio.h>
- #include <stdlib.h>
- int main(void) {
- void *mi_memoria = calloc(1, 1000);
- int *como_int = mi_memoria; /* No hay problema alguno. */
- int t = 0;
- int sz = (1000 / sizeof(int)) - sizeof(int); /* Sepamos el tamaño. */
- while (t <= sz)
- como_int[t] = t * 4;
- t = 0;
- while (t <= sz)
- printf("como_int[%d] = %dn", t, como_int[t]);
- free(mi_memoria);
- return 0;
- }
Add Comment
Please, Sign In to add comment