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
-------------------------------------------------------------------
Agora temos uma assistente virtual no fórum!!! (247)
Manutenção de sistemas Linux Debian e derivados com apt-get, apt, aptitude e dpkg
Melhorando o tempo de boot do Fedora e outras distribuições
Como instalar as extensões Dash To Dock e Hide Top Bar no Gnome 45/46
Como Atualizar Fedora 39 para 40
Instalar Google Chrome no Debian e derivados
Consertando o erro do Sushi e Wayland no Opensuse Leap 15
Instalar a última versão do PostgreSQL no Lunix mantendo atualizado
Flathub na sua distribuição Linux e comandos básicos de gerenciamento
iso de sistema 32 bit em atividade (20)
Impressora Canon Ip 1800 (Drivers) 64 bit (6)
Microfone do meu headset não é recinhecido. Meu notebook é um Acer Asp... (10)