# C code to implement myatoi function

implementation of myatoi function in c.

Atoi function converts a string numeric value into integer value.

# C code to reverse words in place in a string

C program to reverse words in place in a string:

Approach :

Step1: Reverse the whole string

Step2: Reverse the characters in words

e.g.

Before Rev Old: [I am a good coder]

After Rev: [redoc doog a ma I]

New: [coder good a am I]

# Calculating Factorial of large numbers in c

As we all know there is memory limitation in C. If we want to store number which is more than of 4 byte we cannot use int data type. We can use long data type to store value which is upto 8 byte. What after that?. If our value is of more than 8 bytes then we have to implement our own method to store value.

Here is the implementation of calculating factorial for large numbers like 100!

Explanation:

This program works on basic method of multiplication of a two numbers.

1234

X 15

Ans: 18510

Steps are:

Step                                       Digit                       Carry

15*4 = 60;                            0                              6

(15*3)+6=51                       1                              5

(15*2)+5=35                       5                              3

(15*1)+3=18                       8                              1

After this carry digits are extracted and stored in array.  ( if our carry was 25 then we must extract 2 and 5 then store it in array )

So output is: 18510

In program:

Array of 200 lengths is taken to store digits of multiplication result.

Index variable indicates the length of output..

tmp is used to store carry value;

————————————————————————————————————————–

Calculating Factorial of large numbers in c

Her we have taken array size of 200 so we can calculate factorial of a number whose digits are 200. if you want to calculate for more than 200 just increase the size of array.

# C program to mirror binary tree

C function to mirror binary tree.

C Function implementation :

Complete C Code implementation

# Print Ancestor of given node value in binary tree

Print Ancestor of given node value in binary tree.

For Given Binary Search tree find out the ancestor of a given node value .

Node Value                O/P

4                                    8  3  6

13                                8  10  14

Recursive function to print ancestor values for given binary search tree.

Complete code with binary search tree implementation and ancestor printing function.

# C Code Examples

C code to perform operation on array and basic input output of int, float, char, string in c.

 Basic I/O Array Operation Integer  input Array input Float input Array Sorting Char input >Basic Method String input >Bubble Sort >Insertion Sort >Quick Sort >Heap Sort

Star pattern printing using C code. :

C code examples to pattern printing using stars and string function implementation to perform string manipulations.

Star printing patterns in C.                           String function implementation.

C Code Examples to play with numbers.

# Specific level printing in BST

C code to print specific level values in BST. Level 0 mean Root value.

For above binary tree
Level          Values

0                       8

1                      3  10

2                     1   6  14

….

Function implementation for level printing :

Complete C code with implementation of binary tree and level printing in BST.

# Binary Tree implementation with print all paths

Binary Tree implementation code with print all paths in Binary tree Code in C.

# Print all paths in Binary Tree

C function to print all paths in binary tree from root to leaf.

For a given binary tree o/p should be :

Print all paths o/p :

8 3 1

8 3 6 4

8 3 6 7

8 10 14 13

==> Click Here to Get Complete C Code of Binary Search Tree implementation

==> Click here to Get Code for all Path Print and Binary Tree implementation