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
-------------------------------------------------------------------
Aprenda a Gerenciar Permissões de Arquivos no Linux
Como transformar um áudio em vídeo com efeito de forma de onda (wave form)
Como aprovar Pull Requests em seu repositório Github via linha de comando
Aplicativo simples para gravar tela
Quebra de linha na data e hora no Linux Mint
Ubuntu com problemas no áudio (1)
Firefox não abre em usuário não administradores (1)
Sempre que vou baixar algum pacote acontece o erro dpkg (8)
tentando instalar em um notebook antigo o Linux LegacyOS_2023... [RESO... (8)