C Program to Check Whether a String is Palindrome

Palindrome string is a string that reads the same from both forward and backward directions. For example, “madam” reads the same from both directions. If you reverse a palindrome string, the reversed string would be the same as the original one. Here we’ll see how to write C program to check whether a string is … Continue reading “C Program to Check Whether a String is Palindrome”

C Program to Reverse a String

Here we’ll see how to write a C program to reverse a string. Solution 1 The reverse_string() function takes the input string as input parameter and reverses that into the output string. The last character of the input string is set as the first character of the output string, second last character of the input … Continue reading “C Program to Reverse a String”

C Program to Reverse an Integer

Here we’ll see how to write C program to reverse an integer. The reverse_integer() function takes an integer like 5234569 and returns 9654325. Output: Logic: The reverse_integer() function takes the last digit of “in” by doing modulo operation by 10. For example, if in is 5234569, 5234569 % 10 would be the last digit 9. … Continue reading “C Program to Reverse an Integer”

C Program to Sleep in Milliseconds

We don’t have millisecond level control in the sleep() function. But in Linux we can implement our own function that will take duration in milliseconds as input and sleep for that duration. Using usleep() The usleep() function takes the duration in micro seconds as input. We can have a wrapper around this usleep() function that … Continue reading “C Program to Sleep in Milliseconds”

C Program to Delete Linked List

In my previous article I showed how to create a linked list. Now if you no longer need the linked list in your program, you have to delete that. Otherwise, it will lead to memory leak. Here we’ll see how to delete linked list completely. C Function to Delete Linked List This function takes the … Continue reading “C Program to Delete Linked List”

0
0
0
0
0
0