C Program to Find the Shortest Word in a String
A word is a consecutive non-whitespace character set. The C program here will find out the shortest word in a given string. If multiple words are present with the same length of the shortest one, it...
View ArticleC “Hello, World” Program
The iconic “Hello, World” program simply prints the message “Hello, World” on the screen. Brian Kernighan used it as a very simple C example program in late 70’s. It became popular since then. Many...
View ArticleC Program to Print the Current File Name and Line Number
Real life programs are generally very big distributed across many files with hundreds of lines. Sometimes we need to print the current file name and the line number. Like, it greatly helps the...
View ArticleC Program | Log with File Name and Line Number
Logging is an essential part of programming. Logging helps tracking various events, errors, troubleshooting. It helps the developers to great extent troubleshooting a problem if the file name and line...
View ArticleC Program to Implement Queue Using Circular Array
Queue is one of the fundamental data structures used in computer science. As the very nature of a queue, whoever comes first will be served first. That’s why it is called First In First Out (FIFO)...
View ArticleC Program to Implement Stack Using Array
Stack is a collection of data elements serving Last In First Out (LIFO) functionality – whichever element comes last will be removed first. This data structure helps solve a number of real life...
View ArticleC Program to Count Words in a File
We discussed different ways to count words in a file in this article. Here we’ll extend that to count all words in a file. We can think of a file as a collection of lines. We’ll count words of each...
View ArticleC Program to Write to a File
Writing to a file is a basic programming requirement. All information of a running program is generally stored in the physical memory or RAM. They are lost with the termination of the program. If you...
View ArticleC Program to Append to a File
In the previous article, we saw how to write something in a text file. In that case, the previous content, if any, will be overwritten. If there is something in the file to begin with, that content...
View ArticleNetworking Programming – Introduction to socket
Computer networking programming, often referred as socket programming, is about writing programs to exchange information between processes running on connected hosts – computers, mobiles etc. Hosts...
View ArticleBit Fields in C
The variable size of a standard type is always in bytes – not in fraction of bytes. For example, the size of a char type variable is 1, short type variable is 1, in type variable is 4 and so on. We...
View ArticleBackpointer – Concept and Application
We often work with data structures with connected nodes – like trees and graphs. In a tree, the parent nodes generally hold the pointers of their child nodes. But the child nodes can also hold the...
View ArticleMultithreading in C
We can create multiple threads in our C program to execute multiple tasks in parallel. It helps to utilize the CPU resources efficiently. Even though core C programming does not support...
View Article