C 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 need to persist some information, you need to store it in some persistent storage like a disk. Writing to a … Continue reading “C Program to Write to a File”

C Program to Count Words in a File

We discussed different ways to count words in a string 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 line one by one and add them up. This program first opens the file, sample.txt, … Continue reading “C Program to Count Words in a File”

C 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 problems. Like undo / redo functionalities, recursive function implementation, solving arithmetic equations etc. Basic Stack Operations Push: Inserting a new element into … Continue reading “C Program to Implement Stack Using Array”

C 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) data structure. Event Queue or Message Queue are very common examples of this data structure. We’ll see here how … Continue reading “C Program to Implement Queue Using Circular Array”

C 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 number are also added with the log messages. In this article, we discussed how we can add file name and line number with a message. … Continue reading “C Program | Log with File Name and Line Number”

0
0
0
2
2
0