Enviado em 23/04/2019 - 05:05h
Olá pessoal !!!
//-------------------------------------------------------------------
//
// Saida Windows 64 bits:
// ------------------------------------------------------------------
//
// 0: 0x0, 1: 0xe1, 2: 0xf5, 3: 0x5, 4: 0x64, 5: 0x64, 6: 0x64, 7: 0x64, 8: 0x64, 9: 0x64, 10: 0x64,
// sizeof(int): 4, sizeof(long): 4
//
//-------------------------------------------------------------------
//
// Saida Linux 64 bits:
// ------------------------------------------------------------------
//
// 0: 0x0, 1: 0xe1, 2: 0xf5, 3: 0x5, 4: 0x64, 5: 0x64, 6: 0x64, 7: 0x64, 8: 0x64, 9: 0x64, 10: 0x64,
// sizeof(int): 4, sizeof(long): 8
//
//-------------------------------------------------------------------
//
#include <stdio.h>
#define UC unsigned char
unsigned char buf[100] = { 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100 };
long l = 100000000;
void funcao() {
*(int*)buf = l;
printf("0: 0x%x, 1: 0x%x, 2: 0x%x, 3: 0x%x, 4: 0x%x, 5: 0x%x, 6: 0x%x, 7: 0x%x, 8: 0x%x, 9: 0x%x, 10: 0x%x,\n", (UC)buf[0], (UC)buf[1], (UC)buf[2], (UC)buf[3], (UC)buf[4], (UC)buf[5], (UC)buf[6], (UC)buf[7], (UC)buf[8], (UC)buf[9], (UC)buf[10] );
}
int main (void) {
funcao();
printf ("sizeof(int): %d, sizeof(long): %d\n", (int)sizeof(int), (int)sizeof(long));
return 0;
}
Saida Windows 64 bits:
------------------------------------------------------------------
0: 0x0, 1: 0xe1, 2: 0xf5, 3: 0x5, 4: 0x64, 5: 0x64, 6: 0x64, 7: 0x64, 8: 0x64, 9: 0x64, 10: 0x64,
sizeof(int): 4, sizeof(long): 4
-------------------------------------------------------------------
Saida Linux 64 bits:
------------------------------------------------------------------
0: 0x0, 1: 0xe1, 2: 0xf5, 3: 0x5, 4: 0x64, 5: 0x64, 6: 0x64, 7: 0x64, 8: 0x64, 9: 0x64, 10: 0x64,
sizeof(int): 4, sizeof(long): 8
-------------------------------------------------------------------
Atualizando o Passado: Linux no Lenovo G460 em 2025
aaPanel - Um Painel de Hospedagem Gratuito e Poderoso
O macete do Warsaw no Linux Mint e cia
Visualizar arquivos em formato markdown (ex.: README.md) pelo terminal
Dando - teoricamente - um gás no Gnome-Shell do Arch Linux
Como instalar o Google Cloud CLI no Ubuntu/Debian
Mantenha seu Sistema Leve e Rápido com a Limpeza do APT!
Procurando vídeos de YouTube pelo terminal e assistindo via mpv (2025)
Olha que maravilha, Arch no C2D 7400, 2GB de RAM, vídeo onboard e no G... (1)
Mikrotik não abre o webmail-segur... da Locaweb (0)
Jogos baixados na Central de Aplicativos mas que não abrem (1)
debian com wayland, configuracao de teclado. Mudou Tudo! [RESOLVIDO] (1)