Below you will find pages that utilize the taxonomy term “c”
February 17, 2016
Limit String Length in Printf in C
I can’t believe how many times I forget this trick! so I am writing it down so I won’t forget it!
Normally when you use printf function with “%s” formatting to print a string (char *) you rely on C convention of terminating a string with a NULL character (i.e. value 0).
So if you want to print small part of longer string, you copy the part you need to a new buffer and terminate it will NULL.
February 10, 2013
My First Makefile
The following is a sample Makefile for simple project, here I am building a simple “Bloom Filter” library, and “main” program to use it.
The library will have the following files:
hash.h and hash.c bloom.h and bloom.c and we should get “libbloom.a” out of it.
The “main” program will use:
main.c bloom.h libbloom.a and we should get “main” executable. So our make file should look like this:
June 4, 2011
Loop Unwinding Experiment
Few months ago I read an interesting post by Mike Haertel the original author of GNU grep titled “why GNU grep is fast“, one of the reason given is loop unrolling.
Few weeks ago I came a cross the same post which made me more interested on Loop Unrolling, so I decided to experiment with it, I implemented simple function to search for an item inside a list of items, and return as soon as it finds it, soo here is my result: