C Program to Find the Sum of all Digits of a Number

Here we’ll see how to write a C program to find the summation of all digits in a number. For example, the sum of the digits of 43652 is 20 (4+3+6+5+2) The sum_digits() function returns sum of all digits of the input number n. It has a loop. In every iteration it gets the last … Continue reading “C Program to Find the Sum of all Digits of a Number”

C Program to Search for an Element in Linked List

Here we’ll see how to write a C program to find an element in a linked list. The function is_present() takes a linked list (head pointer) and a value (val) as input arguments. If the value (val) is present in any of the nodes, this function returns the pointer of that node. Otherwise it returns … Continue reading “C Program to Search for an Element in Linked List”

C Program to Print the Length of a Linked List

Here we’ll see how to write a C program to print the length of a linked list. The function get_length() takes a linked list as input and returns the length of it. First we’ll create a linked list and pass that list to the get_length() function to print the length of the list. The get_length() … Continue reading “C Program to Print the Length of a Linked List”

C Program to Check Whether Two Linked Lists are Equal

Here we’ll see how to write a C program to compare two linked lists. First we’ll create three linked lists, first two are equal and third one is different. We’ll compare these linked lists using the check_equal() function. The check_equal() function traverses the linked lists until at least one of them reaches to NULL (end). … Continue reading “C Program to Check Whether Two Linked Lists are Equal”

Command Line Arguments in C Programming

An application takes inputs in various ways. It can ask for input from user while it is running. It can read something from file or socket. Another way is, we can give inputs in time of starting the application in the form of command line arguments. For example, when we run Linux commands we give … Continue reading “Command Line Arguments in C Programming”

0
0
0
0
1
0