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”

C 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 developers if we print the file name and line number with debug logs. To do that, you can embed hard coded the … Continue reading “C Program to Print the Current File Name and Line Number”

C “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 use this as a first program to learn a new programming language. It is also used check the readiness of a … Continue reading “C “Hello, World” Program”

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 will print the first one. This program takes a string as input. The first ‘for‘ loop traverses all the … Continue reading “C Program to Find the Shortest Word in a String”

C Program to Find the Longest Word in a String

A word is a consecutive non-whitespace character set. The C program here will find out the longest word in a given string. If multiple words are present with the same length of the longest one, it will print the first one. This program takes a string as input. The first ‘for‘ loop traverses all the … Continue reading “C Program to Find the Longest Word in a String”

4
0
5
1
17
5