Category Archives: String

Another Good Example of Struct using Function and Pointer

code:

 

Using function with Struct user defined type also pointer

code:

why we used *sp in one place and sp in another place ?there s a reason behind this
*sp means address is passing where after the local input takeup it will go but if not use  dereferencing then it will not go outside. So to write we need with address.

and in sp it is read only. so to print sp is enough to show.

vid:

Array of String

theortecical concept source:
http://stackoverflow.com/questions/20347170/char-array-and-char-array

code:

Problem:
source: 101cproblems:

Problem 80: Array of String

Take an array of string named fruitNames and store four fruit names (“Mango”, “Jack-fruit”, “Banana”, “Litchi”). Now iterate the array using loop and print the names of the fruits each in a separate line.

code:

 

Char Pointer Practical Example Using String Input and String/Char Variable Passing

code:

Theory:

 

 

Lowercase to Uppercase with array

code:

Another approach:

Another Approach I found on my head:

 

Extract Digits From a Number and Make a Sum of all the digits and show this in C

Code is here:

Output:

Modular Beautiful Code: 😀

Actually array return function is not directly possible in C and I am finding the solution here.

Took Slightly Help From this link:
https://cboard.cprogramming.com/c-programming/150996-extracting-digits-integer.html

http://mathforum.org/library/drmath/view/56002.html

strcmp() explained perfectly

code:

 

Another Approach To Find the Length Of String

code:

 

String Secret Revealed in C

String Input Take Without any gets function just scanf is enough for taking any input withlout gets function

another example:

another:

 

 

String Frequency Count

code:
simple code:

good output:

Reference: http://www.codeforwin.in/2015/04/c-program-to-calculate-the-frequency-of-each-character-in-a-line.html

101cproblems.com solution:

 

 

String Palindrome Problem

My Own Logic:

Another logic:

Simple:

another good logic:

 

 

Count word

Problem from 101cproblems.com:
Write a program which will take a sentence as input and tell us how many words are there. [If user gives input “I love Bangladesh”, then the output should be: 3]

code:

 

String Problem: Uppercase to Lowercase, Lowercase to Uppercase

Problem 70: Case Fix

You are given a string mixed with uppercase and lowercase letters . Your task is to write a program which will
flip the letters : (UpperCase -> LowerCase, LowerCase -> UpperCase)

Example:
INPUT:        OUTPUT:

eLepHanT   Elephant

cAt                  Cat

SuNDAY       Sunday

code:

not upto the output yet:

beautiful code with exacts output:

 

 

String Problem: ASCII table related

Problem: Write a program which takes a string of alphabet as input and replace all the characters with the 3rd immediate character of it. All the alphabets of the input string will be small letter. [If user gives input “abc” you should print “def”, if user gives input “xyz” you should print “abc”]

mycode:

 

Concatanated String Problems

Problem: Take three different string as input from the user(“We”, “ Love” and “ Bangladesh”). Now concate these three string and print it (“We Love Bangladesh”). [There is a leading space in “ Love” and “ Bangladesh”]

Code:

Another approach: