Allocating multidimentional array at runtime in C

Arrays in C language are static in nature, and cannot be resized at runtime. The effect of runtime allocation of an array could be achieved by hierarchically allocating blocks of memory at runtime. Below we discuss the mechanism to allocate multidimensional arrays.
Continue reading “Allocating multidimentional array at runtime in C”

Sieve of Eratosthenes : A basic implementation

The Sieve of Eratosthenes is a process to find all primes not exceeding a specific positive integer. The process is simple. First all the numbers within the range is populated in a list.The process strikes out all the numbers in the list which are multiple of some previous number. This strike-out process starts with the integer 2, thus first all the multiple of 2 upto the limit n are striked out. Note that the number 2 itself is not striked out, because it is not a multiple of any integer lesser than it (except 1). Next the just following unstriked integer is selected, which is in this case 3, and then all the multiples of 3 are striked out from the like, and again the next unstriked out integer is selected and the process continues until no such integer remains in the list which is unstriked and a multiple of some integer lesser that it. Note that the next integer to strike out after the ith unstriked integer is i * i , as all the multiples of i less than i are striked in the previous passes. At the end if the process only those numbers will be still unstriked in the list which are not a multiple of some other integer lesser that it, thus only the prime numbers will remain unstriked in the list. At the end of the process the list can be rescanned and the unstriked integers could be found.
Read more about Sieve of Eratosthenes here: http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
Read the complete implementation

wcat : A GNU cat implementation

Everybody has used the GNU or UNIX cat program in the command line. It is used to concatenate files and dump it into the standard output, or can simply be redirected to another file. Long ago i started to write my own version of the cat program. I have implemented each and every function which cat supports, and also made it look identical, except some messages. Although this is not a cat clone, and has no connection with the source code of GNU cat. This code was made by inspecting the output behaviour of GNU cat. This is named wcat. I started this because this was the most simple code to write and was intended for the Whitix OS project run by Mathew (http://www.whitix.org/). This is a very good OS development project for the beginners to start with. I could not at present actively participate in this project because of the time limitations here at my end.
Check out the code

An ID3v1 Tag Parsing Library

id3_logo

ID3 tag is an mp3 audio media file tagging system. The ID3 tags are stored in a pre-defined location in the mp3 media file, either in the start or at the end (or both). There are two major versions of the ID3 tags. ID3v1 and ID3v2. The tag store data about the song, like track name, album name, artist name, genre, track no, year, composer, licensing information, lyrics, even multiple images inside the tag. To get more information about ID3 tag please check the official website of ID3 tag: http://www.id3.org/, also check this article What are ID3 Tags all about?

Continue reading to get the library

Synchronization Safe Integer

Synchronization safe integers are related to ID3v2 tags. ID3v2 tags has a dynamic structure where the length of the tag is variable and inside the tag, there can stay a lot of frames which again can be of dynamic sizes. The size of the tag is stored in the ID3v2 tag header is of length 4 bytes long. These 4 bytes are stored in a special format which is called a synchronization safe integer. Also from ID3v2.4 tags also the frame size bytes which are stored in the frame headers, describing the frame’s length, are stored as 4 byte synchronization safe integer.

Continue reading “Synchronization Safe Integer”

Hero’s Method : Evaluating square root of a real number

A floating point number is given. the task is to evaluate the value of its square root. We will discuss how to find the square root of a real number in this post, and also present a C Language code which does this job. The value of the root will be evaluated with the Hero’s method.
Continue reading “Hero’s Method : Evaluating square root of a real number”