Data Structure Tutorial

Programming Approach

Flow Chart

Define Data Structure

DS Problem Solving

Algorithm

DS Data Types

DS Arrays

DS Stack

DS Queue

Number System

Spare matrix

Structure

Polynomials

Application of Stack

DS Linked List

DS Functions

DS Tree

DS Graph

Searching

Exercise Searching

Sorting

Hash Table

DS Questions

Free Workshop on Course Awareness Program for BCA, MCA, IT Students, By ANKIT SIR on Date: 4thFebruary 2023, Venue: Rajouri Garden, near Ramesh Nagar Metro Station. (Topic Highlight - Computer Programming, Website Development). For Registration or any query Whatsapp no. 8287212590

Data Structure Function

A function is a block of statements that perform a task. A function can be call when required instead of writing same code again and again. When the function is call the control passes to that function, execute the function statement and return back from where it is called.

A function can return only one value at a time, by default its return type is integer. If you want that a function should not return any value in that case you must mention void.

A function contains 3 parts:
1. Declaration (Prototype)
2. Calling
3. Definition (Body).

Note: Main is also a function. It can be called from other functions.There is no limit of creating function in a C-Program.

        Example to print "Hello"

        Void fun ();
        Void main ()
        {
        fun ();
        printf ("I am back in main");
        getch ();
        }

        Void fun ()
        {
        printf ("\n Hello");
        }
        

Why we need function?
1. It avoid rewriting the same code again and again
2. Function make easier to write programs and keep track what they are doing.

Functions are of 2-types

1. Call by Value: When a function is called and a value is passed using arguments it is known as call-by-value. The changed value will not reflect to the main function.
2. Call by Reference: When a function is call and address of a variable is passed it is known as call by reference. The changed value will reflect to the main function.

Example:
Recursion function: A function is called recursive if the function calls itself until the condition is not satisfied. This feature of calling the same function from itself was not supported in older programming languages like FORTRAN or Basic. But almost all modern programming languages support recursion.

Note: In recursion function we cannot use any loop only if condition is used
Questions:
1. Find factorial.
2. Find Greatest Common Divisor

Free Workshop on Course Awareness Program for BCA, MCA, IT Students, By ANKIT SIR on Date: 4thFebruary 2023, Venue: Rajouri Garden, near Ramesh Nagar Metro Station. (Topic Highlight - Computer Programming, Website Development). For Registration or any query Whatsapp no. 8287212590