When to Prefer Linked List over Array in C?

As a C programmer when we need to deal with multiple data elements of same type, we think of using array or linked list. Many times we scratch our head which data structure we should go for.. Though Array and linked list have many similarities, they are two fundamentally different data structures. Let’s see when … Continue reading “When to Prefer Linked List over Array in C?”

C Program to Implement a Singly Linked List

What is Singly Linked List? Linked List is a collection of interconnected nodes that together represent a sequence. Connected node means if you have access of a node, then you can get access to the next nodes even though they are not located in consecutive memory locations. For singly linked list, you can traverse the … Continue reading “C Program to Implement a Singly Linked List”

How to Access MySQL Database from C Program?

MySQL is an open sourcce database management system (DBMS). It is very popular among the web developers as it is part of LAMP (Linux, Apache, MySQL, PHP/Perl/Python) stack. Many popular large scale websites like WikiPedia, Facebook, Youtube use this database. Many times we need to use access MySQL database from C program. Here we’ll see … Continue reading “How to Access MySQL Database from C Program?”

How to Implement Periodic and Single Shot Timers in Linux?

In our program, we often need to do some tasks repeatedly with some time interval. We can think of a simple solution of having a loop with the actual task and a sleep()..  The sleep() function can wait for some time and then we can call a function to do the task. Problem here is … Continue reading “How to Implement Periodic and Single Shot Timers in Linux?”

Detect and Remove Loop in Linked List in C

What is Loop in Linked List? In a standard singly linked list, the last node always points to NULL. If you traverse such a linked list, the traversal will end at the last node. That means you can not go anywhere from the last node. Here is an example of a standard linked list. Loop … Continue reading “Detect and Remove Loop in Linked List in C”

1
2
2
3
3
1