-
Recent Posts
Recent Comments
Archives
Categories
Meta
Tag Archives: c
How to use ancient Morse code to solve a modern problem
If you own a Raspberry Pi mini computer the following problem may sound familiar to you: You just connected your Rasperry Pi to a network with automatic DHCP. Now you need to find out what IP address has been assigned … Continue reading
Posted in c, Information Theory, Linux, Raspberry Pi, Uncategorized
Tagged c, dhcp, gpio, ip address, linux, morse code, programming, Raspberry Pi
Leave a comment
Subroutines, Functions, Methods
Most, if not all, programming languages allow you to create subroutines, functions, or methods, all of which follow the same principle. You can think of them as black-boxes that contain source code to perform a specific task. For example, you … Continue reading
Posted in Programming Essentials, Uncategorized
Tagged c, function, method, parameter, return value, source code, subroutine, variable
Leave a comment
Swapping Variables
Many algorithms, including the world-famous Euclidean, require to swap the values of two variables. So you probably know the following principle. int x = 8; int y = 123; int tmp = x; x = y; y = tmp; However, … Continue reading
Posted in Bit-Twiddling, Information Theory, Uncategorized
Tagged bit-twiddling, c, logic, variable, xor
Comments Off on Swapping Variables
Lost in translation (C vs. Assembly Language)
In my classes on microcontroller programming I often draw comparisons between C and assembly language. This is to show my students that either programming language has both advantages and disadvantages. While the efficiency of C code predominantly depends on how … Continue reading
Posted in Programming Essentials, Uncategorized
Tagged 8051, assembly, c, efficiency
Comments Off on Lost in translation (C vs. Assembly Language)
Pointers and References – Part 3 (Kinky Stuff)
Once in a while, I show my students some fancy examples of what you can (but shouldn’t) do with pointers. Most students would be watching the screen with baffled looks on their faces. Those who cannot find any interest in … Continue reading
Pointers and References – Part 2 (Intermediate Stuff)
This is my second posting on pointers and references. In part 1 you could read about the basic nature of pointers. Now we will have a look on two very common examples of how pointers are being used. 1. Passing … Continue reading
Posted in Pointers, Programming Essentials, Uncategorized
Tagged c, pointer, reference, variable
Leave a comment
Pointers and References – Part 1 (Rookie Stuff ;)
Pointers are subject of fear for a large number of people. Some of them hate pointers because they can cause nasty problems that are difficult to debug, others hate them because they never really understood what pointers actually are. Indeed, … Continue reading
Posted in Pointers, Programming Essentials, Uncategorized
Tagged c, pointer, reference, variable
Comments Off on Pointers and References – Part 1 (Rookie Stuff ;)
Parity
Data transfer inevitably threatens data integrity. It does not matter whether you save and restore files on your hard disk or you transmit data over long distances. Bits can always get twisted by interfering electric and electromagnetic fields. TCP/IP uses … Continue reading
Masking
In this posting I’m going to explain a bit-twiddling technique called masking. It is used to extract (and alter) specific bits in a word of bits, for example a byte. You might be familiar with IP subnet masks in network … Continue reading
Posted in Bit-Twiddling, Uncategorized
Tagged assembly, bit-twiddling, c, masking, microcontroller
Comments Off on Masking