Member-only story

C: Bits And Bytes

Mi'kail Eli'yah
2 min readJun 12, 2019

Bit operations or bit manipulations are the fundamental steps in embedded systems. They form the signaling information, e.g. flags and status, especially in embedded systems. The bits form the bytes, which will be formatted and addressable to any forms of data structure. This is the reason why we should start here.

Here we also separate the test usages for different test cases:

For defensive C, before we send in any data, we should check the sizing of the memory containment, and how it could be implicitly be formatting it.

#include <stdio.h>
#include <math.h>
//double pow(double x, double y);
//float powf(float x, float y);
long double powl(long double x, long double y);

int main()
{
size_t designated_length = 10; // long unsigned int
int data[designated_length]; // uninitialized
size_t over_sized = 2;
printf("Hello %ld \n", designated_length);
printf("Hello %ld bytes\n", sizeof(designated_length));

for(int loop = 0; loop < 10; loop++)
printf("%d ", data[loop]);

printf("\n answer: %ld", pow(2,4));
printf ("%d", (int) pow (3, 4)); // forced casting

return 0;
}

Github code for the tutorial: Chapter_03_Bits_And_Bytes

--

--

Mi'kail Eli'yah
Mi'kail Eli'yah

No responses yet