#include <stdlib.h> #include <stdint.h> #include <string.h> #include <stdio.h> int main(int argc, char *argv[]) { int buf_size = 1024; uint8_t *buf = malloc(buf_size); *(uint32_t *) (buf + 4) = 18010; strcpy((char *) buf + 8, "Hello World!"); printf("buf + 0:%d ", *(uint32_t *)(buf + 0)); printf("buf + 4:%d ", *(uint32_t *)(buf + 4)); printf("buf + 8:%s ", buf + 8); free(buf); return 0; }