endiantest

A test for endian-ness. Initially used in service of a different project but was made into its own repo
Log | Files | Refs | README | LICENSE

commit 73b2fd56a4f151cd1b632ecc2f3e64328fe88c51
parent dc9d80aff9333507a8555c5223379077d75ef7ad
Author: M. Yamanaka <myamanaka@live.com>
Date:   Mon, 28 Dec 2020 20:06:39 -0500

slight reduction of code

Diffstat:
Mendiantest.c | 4+---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/endiantest.c b/endiantest.c @@ -24,7 +24,6 @@ int main(){ */ int n = 65; - int* pn = &n; /* Having a char pointer point to the "first byte" of the integer could either mean that it's pointing to "00" or to "65". @@ -46,8 +45,7 @@ int main(){ char* | +0 | +1 | +2 | +3 | */ - char* pcn = (char*)pn; - + char* pcn = (char*)&n; if(*pcn == '\0' && *(pcn + 3) == 'A') printf("big endian\n"); else if(*pcn == 'A' && *(pcn + 3) == '\0') printf("little endian\n");

Generated using stagit (https://codemadness.org/stagit.html)