Category: C programming

python tutorials and learn python

Created with Sketch.

C program to print a string

  C program to print a string C program to print a string using various functions such as printf, puts. It terminates with ‘\0’ (NULL character), which is used to mark the end of a string. Consider the following code: printf(“Hi there! How are you doing?”); Output: Hi there! How are you doing? The string…
Read more

String length in C

  String length in C String length C program to find length of a string, for example, length of the string “C programming” is 13 (space character is counted). The null character isn’t counted when calculating it. To find it, we can use strlen function of “string.h.” C program to find length of a string…
Read more

String compare in C

  String compare in C How to compare strings in C? You can use do it using strcmp function, without strcmp function and using pointers. Function strcmp is case sensitive and returns 0 if both the strings are same. C compare strings #include <stdio.h> #include <string.h> int main() { char a[100], b[100]; printf(“Enter a string\n“);…
Read more

String copy in C

  String copy in C C program to copy a string using library function strcpy and without using strcpy. String copy C program #include <stdio.h> #include <string.h> int main() { char source[1000], destination[1000]; printf(“Input a string\n“); gets(source); strcpy(destination, source); printf(“Source string: %s\n“, source); printf(“Destination string: %s\n“, destination); return 0; } Output of program: Copy string…
Read more

String concatenation in C

  String concatenation in C C program to concatenate two strings, for example, if the two input strings are “C programming,” and ” language” (note the space before language), then the output will be “C programming language.” To concatenate the strings, we use strcat function of string.h, to concatenate without using the library function, see…
Read more

C program to reverse a string

  C program to reverse a string C program to reverse a string that a user inputs. If the string is “hello” then, the output is “olleh.” C program to reverse a string using strrev, without using strrev, recursion and pointers. A string which remains the same on reversal is a palindrome. Reverse a string…
Read more

Palindrome program in C language

Palindrome in C: A Comprehensive Guide with Examples Introduction A palindrome is a sequence of characters that reads the same forward as backward. In this blog post, we’ll explore the concept of palindromes and delve into the details of writing a C program to determine whether a given string or number is a palindrome. We’ll…
Read more

C program to delete vowels from a string

  C program to delete vowels from a string C program to remove or delete vowels from a string: if the input string is “C programming,” then the output will be “C prgrmmng.” In the program, we create a new string and process input string character by character, and if a vowel is found it…
Read more

C substring, substring in C

  C substring, substring in C C substring program to find substring of a string and its all substrings. A substring is itself a string that is part of a longer string. For example, substrings of string “the” are “” (empty string), “t”, “th”, “the”, “h”, “he” and “e.” The header file “string.h” does not…
Read more

C program to check subsequence

  C program to check subsequence C program to check Subsequence, don’t confuse subsequence with substring. In our program, we check if a string is a subsequence of another string. A user will input two strings, and we find if one of the strings is a subsequence of the other. Program prints yes if either…
Read more