Skip to main content

Posts

Showing posts from June, 2020

Pointer to a Function in C Program #DOTC_Mdb

Pointer to a Function in C Program.   Hi Everyone, Today we will discuss about Pointer to a Function in C Program and in other word we can say uses of Function in Pointers. In my previous blogs we already discussed about Pointers and Functions so please go through that blog carefully before this topic. Previous topics like Pointers and Functions you can able to see it in my archive folder. dheeraj60.blogspot.com Let’s Discuss about Pointer to a function or Pointer uses in Function programs. Just like variable pointers can also be passed to a function. C program allows passing a pointer to a function. For doing this, we simply declare the function parameter as a pointer type. Let’s understand with example of passing pointer to a function in C.   #include <stdio.h> #include <stdlib.h>   void increment(int   *incr, int a) {     *incr = *incr+a; } int main() {     int salary=0, incentive=0;     pr...

Structure In C Program #DOTC_Mdb

Structure in C Program.   Hello Everyone, Today we will discuss about Structure in C Program . Before starting please go through my previous blogs in archive folder for your reference. dheeraj60.blogspot.com Let’s Discuss about Structure in C : As we know in Array we define type of variable that can hold several data types of the same types. Whereas Structure is basically used to represent a record, in other word we can say structure is another user defined data type available in C that allows to combined data items of different kinds. Assume we need to store the data of students like student name, age, address, enrolment number etc. One way of doing this would be creating a different variable for each attribute, however when you need to store the data of multiple students then in that case, we need to create these several variables again for each student. This is bit complex but we can solve this problem easily by using structure. We can create a structure that has members f...

Array to Function in C Program #DOTC_Mdb

Array to Function Program in C. Hi Everyone, Today we will discuss about Array to Function in C. This Topic is interesting and we can use array in C functions like function call value and function call by reference. Before starting this topic please go through below topics. https://dheeraj60.blogspot.com/2020/06/array-and-its-beneifts-in-c-program.html https://dheeraj60.blogspot.com/2020/06/multi-dimensional-array2d-and-3d-in-c.html https://dheeraj60.blogspot.com/2020/06/call-by-reference-function-uses-and.html https://dheeraj60.blogspot.com/2020/06/function-call-value-uses-and-benefits.html   Let’s Discuss about Array to function. Just like variables, array can also be passed to a function as an argument as of now we used variables in functions. Passing array elements to a function is similar to passing variables to a function.   Let’s understand passing simple array in Function by below program.   #include <stdio.h> #include <stdlib.h> void val...

Function call value uses and benefits in C program #DOTC_Mdb

Function   c all value in C program. Hi Everyone, Today we will discuss about Function call value in C Program and it’s benefits. In Previous blog we discussed about function call by reference and overview of Function in C program. So before starting Function call value please see my below blogs for your reference.   https://dheeraj60.blogspot.com/2020/06/overview-of-functions-in-c-program.html https://dheeraj60.blogspot.com/2020/06/call-by-reference-function-uses-and.html   Let’s Start with Function call value : The Function call by value is a method of passing arguments to a function which copy the actual value of an argument into the formal parameter of the function. Changes made to the parameter inside the function have no effect on the argument. In C Program by default it uses call by value to pass arguments. In other word, it means the code within a function cannot alter the arguments used to call the function. Let’s understand the Actual parameters and Forma...

Call by Reference Function uses and Benefits in C Program #DOTC_Mdb

Call by Reference Function in C Program.   Hi Everyone, Today we will discuss about call by Reference Function in C . In my previous blog I explained about overview and benefits of functions in C so before starting this topic please go through below blog so that you can easily understand Call by reference Function.   https://dheeraj60.blogspot.com/2020/06/overview-of-functions-in-c-program.html Let’s start with call by reference function in C Program. First thing we need to start the parameters to understand reference function. The parameters are Actual Parameter and Formal parameter. Actual parameter that appears in function call while parameters that appear in function declarations is known as formal parameter. Let’s understand with one example . Int add (int i , int j); Here i and j are formal parameter   and calling the functions as below is Actual parameter. Int a =add(100,200);   So the call by reference method of passing arguments to a function cop...

Overview Of Functions in C Program #DOTC_Mdb

Overview of Functions in C.   Hi Everyone, Today we will discuss about Function in C and its uses and benefits in C Program. In my Previous blog I discussed about Pointers   so you can use Pointers in Functions as well . So before starting Functions in C please go through my previous blog in below link where you will be able to see the topics in archive folder and it’s easy for you to understand the programs and uses of Functions in C. dheeraj60.blogspot.com Let’s Start with Function In C. Function is a block of statements that performs a specific task, For re usability we use Function in C Program If you are building an application in C language and in one of your program, you need to perform the same task more than once we can use functions. Uses of Functions in C: 1.      C functions are used to avoid rewriting same code again and again in a program. 2.      No limit in calling C functions to make use of same functionality wh...