Free
|
C language is a middle level language. It is a structured language. C language is a case sensitive language. All syntax written in c language is in lower case. C is the basis for C++.
|
|
|
|
Functions in CC function is that block of code which does one or some tasks with specified purpose. Basic Structure of Functions return_ data_type Name of function(arg1, arg2)
data _type _declarations of arguments;
{
Body of Function
}
This program has function named 'sum' which sums the value of two numbers and returns to the main function. ;This Simple Program Calculates Factorial of Number. #include <stdio.h> //header file #include<conio.h>//header file void factorial (int); void factorial (int x) for (i=1; k <=n; ++i) printf(“Factorial of %d is %d\n”, n,no);
printf(“Enter a no\n”); scanf(“%d”, &no); return 0; What is Void?void anyFunction(void) The first void is the return type of the function, that is what will be returned when the function is called. Void simply indicates that the function does not return a value. When we have to return a value we will write: int add(int a, int
b) void can also be used in the function's parameter list to explicitly specify that we want the function to take no actual parameters when it is called as we can see above, the second void. What is Recursion? Functions and passing argumentsCall by Value
Call by Reference
Passing a pointer to an array to a function.
Call by Value vs Call by Reference. Difference between call by value and call by reference in C?Simple C program demonstrating call by value and call by reference. Valued called is 10.
Output: Call by Value 10 Call by Reference 10 Pointers as Function ArgumentsSwapping of two numbers.
COPYRIGHT 2009 ALL RIGHTS RESERVED FREECPROGRAMS.COM |
|