
Enviado em 01/06/2013 - 12:05h
#include <stdio.h>
#include <stdlib.h>
typedef struct OBJECT OBJECT;
struct OBJECT
{
int id;
int flags;
};
OBJECT *win;
void create (void)
{
win = (OBJECT*) malloc (sizeof(OBJECT));
if (!win)
{
printf ("xi, ferrou ... sem memoria ;)\n");
exit (-1);
}
win->id = 200;
win->flags = 300;
}
void change_id_flags (OBJECT *o)
{
int *p;
p = (int*)o; // get id
*p = 2222; // set id
p++; // change to flags ... get flags
*p = 3333; // set flags
}
int main (void)
{
create ();
// ORIG: 200, 300
//
printf ("\nORIG OBJECT->id: %d\n", win->id);
printf ("ORIG OBJECT->flags: %d\n\n", win->flags);
printf ("------- CHANGING -------\n\n");
change_id_flags (win);
// CHANGED: 2222, 3333
//
printf ("NOW OBJECT->id: %d\n", win->id);
printf ("NOW OBJECT->flags: %d\n", win->flags);
return 0;
}
Cirurgia para acelerar o openSUSE em HD externo via USB
Void Server como Domain Control
Modo Simples de Baixar e Usar o bash-completion
Monitorando o Preço do Bitcoin ou sua Cripto Favorita em Tempo Real com um Widget Flutuante
Como fazer a conversão binária e aplicar as restrições no Linux
Como quebrar a senha de um servidor Linux Debian
Como bloquear pendrive em uma rede Linux
Um autoinstall.yaml para Ubuntu com foco em quem vai fazer máquina virtual
Instalar GRUB sem archinstall no Arch Linux em UEFI Problemático









