Posts Tagged ‘C’

How do Bitmasks work?

Assembly Code - Thumbnail

What are Bitmasks? In computer science, a mask is data that is used for bitwise operations. Essentially it is a variable. They are very often used in C programs. Bit operators These are the bit operators: ~ Bitwise NOT (not to be confused with Logical NOT ‘!’) & Bitwise AND (not to be confused with [...]

Google Code Jam 2012 – Round 1B 2012

Google Code Jam Logo Thumbnail

5614 tried the first problem, but only 3281 people are listed in the scoreboard. So quite a lot tried to solve a problem, but couldn’t even solve one. I think these problems were much harder than the ones from Round 1A 2012. Problem 1 (Safety in Numbers): Small Set: 2695/5614 users (48%) Large Set: 2016/2686 [...]

Get your programs assembly code and more information

Assembly Code - Thumbnail

I’ve talked today with a fellow student about some system internals and we weren’t sure what actually happens. So I needed the assembly code of some example programs. General Information It is important to know that I will use AT&T syntax in this article! This is AT&T Syntax: And this is Intel Syntax: Pointers %esp: [...]

Surprising C errors

Compare programming languages

Those errors might be surprising and a good exercise for C beginners: Empty printf Macros Single and Double quotes Thanks to drpaulcarter.com for this example: Pointers Loops No compiler error, but an infinite loop. Null terminator of Strings Again, you don’t get a compiler error, but some strange results: Further reading C Preprocessor and macros [...]

Colorize your scripts output

Gnome-Terminal

The bash is very nice if you want to know exactly what your scripts are doing. Unfortunately, its almost always white colored text on a black background, without any accentuation. No bold text, nothing underlined and no colors are used. You can change this standard behaviour. You can add color to your output. This is [...]