SlideShare une entreprise Scribd logo
1  sur  9
Function is a self contained block of a statements
   enclosed between braces that performed a specific
 tasks or a function is a group of numbers of repeated
    statements in a program into a single unit and is
     identified by a name known as function name
 There may be one or more function in a program but
  the main function is a essential part of the program.
Function can be implemented any where in a program
  wherever it is needed, so as to prevent repetition of
   same instructions again and again in the program
For example we might use the factorial of a number at
      different places in a program the same set of
  instruction for calculating factorial of a number are
                   places in a function
   Function reduces the size of the program as repetition of
    instruction is reduced because these are written only once in a
    function that is instead of writing debugging and compiling the
    same set of instructions again and again the port can be re used.
   Function supports modular programming in which a large
    program is divided into smaller self contained parts. Each of
    which as a unique identification which makes the program easy
    to write understand debugging and maintained.
   Function promotes portability of a programs since function
    writing are independent of system dependent features
   Designing of large and complex programs becomes very easy
    and fast using function. This is because different functions can be
    involved In which it can be later combined to make the complex
    program, which results in reduction of time and cost
   Different data sets can be transferred to the function ,each time it
    is invoked which helps in saving a lot of memory space by
    allowing same set of statements to be used for different set of
    data
   In “c” language ,a function can call it self again ,this is known as
1.   Library function
2.   User define function

    Library function : They are redefined and precompiled that are designed
     to perform for sum specific task. Information is passed to these functions
     through arguments and returned through the returned statement. for ex
     to calculate the square of a number and square root of a number power of
     a number and length of a string etc.
    Some of the library functions are print f, scan f , get character to upper()
     to lower()
    User defined function : They are those functions which programmer
     writes on his own as per the requirements in the program .So functions
     which are defined specifically by the user to meet his requirement are
     called user define function. Every “C” program contains at least one
     function that is main ( ) every function in “C” consist of following
     components
    (1) function definition
    (2) function declaration or function prototype
    (3) function call
   An array is a finite ordered set of homogeneous
    elements. Arrays is used to handle a large amount of
    data without the need to declare many individual
    variables separately. All the array elements must be
    either of simple data types like integers float character
    double character etc or they can be any user defined
    data types like structure and unions
   These are of three types
1.       One dimensional arrays
2.       Two dimensional arrays
3.       Three or multi dimensional arrays

        One dimensional array: An array with one dimension is referred
         as one dimension array i.e. int a [ ]

        Two dimensional array: An array with two dimensional is referred
         as two dimensional array i.e. int a [ ] [ ]; two dimensional arrays
         results in a matrix of rows and columns

        Three or multi dimensional arrays: An array with more than two
         dimensions is know as multidimensional array. An array may
         consist of any number of dimension subjects to the restriction put
         by a compiler depend upon the language i.e. int a [ 3 ] [ 4 ] [ 5 ]
A string is a group of character which can be store in a character array
    many a time also called a string.
A string is a collection of character‟s terminated by a null character „0‟.
The null character indicates the end of the string.
Each character that compose a string is stored in one dimensional char
    type array in contiguous memory locations for ex “Try Again” is a
    collection of character‟s „T‟ „R‟ „Y‟ „A‟ „G‟ „A‟ „I‟ „N‟ and terminated by
    a null character

STRING VARIABLE: It is an array of character's that has a defined
   length. it can be used to store value

#include <stdio.h>
#include<conio.h>
   Int strlen(s): This function takes one argument s
    which can be a string constant or a string
    variable. It returns the number of characters in
    the string s excluding the NULL character
    („0‟). If string is empty, it return zero.
   A pointer is a variable that contains the address
    of another variable in memory. Suppose I is a
    integer variable having value 10 stored at
    address 2202 and address of I is assigned to
    variable j, then j is a pointer variable pointing
    to memory address stored in it. In other
    words, j is a pointer variable containing
    address of I (i.e.2002)
   Pointer variable is also known as address
    variable as it always store address of some
    other variable.
   Data-type*ptr-var-name;
   Program demonstrate use of pointer variable and
    address of operator
   #include<stdio.h>
   #include<conio.h>
   main()
   {int I,*ptr;
   Clrscr();
   i=5;
   Ptr=&I;/*store address of i*/
   Printf(“value of i+%d”,i);
   Printf(“n address of i=%u”,$i);
   Printf(“nvalue of ptr=%u”‟ptr);
   Getch();

Contenu connexe

Tendances (20)

Pointers
PointersPointers
Pointers
 
C intro
C introC intro
C intro
 
Pointers in c v5 12102017 1
Pointers in c v5 12102017 1Pointers in c v5 12102017 1
Pointers in c v5 12102017 1
 
Introduction to c++
Introduction to c++Introduction to c++
Introduction to c++
 
structure and union
structure and unionstructure and union
structure and union
 
Unit v
Unit vUnit v
Unit v
 
C language 3
C language 3C language 3
C language 3
 
C programming session 05
C programming session 05C programming session 05
C programming session 05
 
Declaration of variables
Declaration of variablesDeclaration of variables
Declaration of variables
 
Ch13
Ch13Ch13
Ch13
 
Computer Science:Pointers in C
Computer Science:Pointers in CComputer Science:Pointers in C
Computer Science:Pointers in C
 
Programming in C Session 1
Programming in C Session 1Programming in C Session 1
Programming in C Session 1
 
C programming session 08
C programming session 08C programming session 08
C programming session 08
 
Pointers In C
Pointers In CPointers In C
Pointers In C
 
Presentation on c structures
Presentation on c   structures Presentation on c   structures
Presentation on c structures
 
User defined functions in matlab
User defined functions in  matlabUser defined functions in  matlab
User defined functions in matlab
 
Programming in C sesion 2
Programming in C sesion 2Programming in C sesion 2
Programming in C sesion 2
 
Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++
 
C language ppt
C language pptC language ppt
C language ppt
 
Bcsl 031 solve assignment
Bcsl 031 solve assignmentBcsl 031 solve assignment
Bcsl 031 solve assignment
 

Similaire à Shanks

C presentation! BATRA COMPUTER CENTRE
C presentation! BATRA  COMPUTER  CENTRE C presentation! BATRA  COMPUTER  CENTRE
C presentation! BATRA COMPUTER CENTRE jatin batra
 
Functions in c language
Functions in c language Functions in c language
Functions in c language tanmaymodi4
 
Functions in c language
Functions in c languageFunctions in c language
Functions in c languageTanmay Modi
 
C programming course material
C programming course materialC programming course material
C programming course materialRanjitha Murthy
 
C programming session 04
C programming session 04C programming session 04
C programming session 04Dushmanta Nath
 
C language presentation
C language presentationC language presentation
C language presentationbainspreet
 
Concept of c data types
Concept of c data typesConcept of c data types
Concept of c data typesManisha Keim
 
04. WORKING WITH FUNCTIONS-2 (1).pptx
04. WORKING WITH FUNCTIONS-2 (1).pptx04. WORKING WITH FUNCTIONS-2 (1).pptx
04. WORKING WITH FUNCTIONS-2 (1).pptxManas40552
 
Interview Questions For C Language
Interview Questions For C Language Interview Questions For C Language
Interview Questions For C Language Rowank2
 
C UNIT-3 PREPARED BY M V B REDDY
C UNIT-3 PREPARED BY M V B REDDYC UNIT-3 PREPARED BY M V B REDDY
C UNIT-3 PREPARED BY M V B REDDYRajeshkumar Reddy
 
Chapter Functions for grade 12 computer Science
Chapter Functions for grade 12 computer ScienceChapter Functions for grade 12 computer Science
Chapter Functions for grade 12 computer ScienceKrithikaTM
 
Unit_5Functionspptx__2022_12_27_10_47_17 (1).pptx
Unit_5Functionspptx__2022_12_27_10_47_17 (1).pptxUnit_5Functionspptx__2022_12_27_10_47_17 (1).pptx
Unit_5Functionspptx__2022_12_27_10_47_17 (1).pptxvekariyakashyap
 
CS 360 LAB 3 STRINGS, FUNCTIONS, AND METHODSObjective The purpos.docx
CS 360 LAB 3 STRINGS, FUNCTIONS, AND METHODSObjective The purpos.docxCS 360 LAB 3 STRINGS, FUNCTIONS, AND METHODSObjective The purpos.docx
CS 360 LAB 3 STRINGS, FUNCTIONS, AND METHODSObjective The purpos.docxfaithxdunce63732
 
Concept Of C++ Data Types
Concept Of C++ Data TypesConcept Of C++ Data Types
Concept Of C++ Data Typesk v
 

Similaire à Shanks (20)

C presentation! BATRA COMPUTER CENTRE
C presentation! BATRA  COMPUTER  CENTRE C presentation! BATRA  COMPUTER  CENTRE
C presentation! BATRA COMPUTER CENTRE
 
FUNCTION CPU
FUNCTION CPUFUNCTION CPU
FUNCTION CPU
 
Functions in c language
Functions in c language Functions in c language
Functions in c language
 
Functions in c language
Functions in c languageFunctions in c language
Functions in c language
 
C programming course material
C programming course materialC programming course material
C programming course material
 
C programming session 04
C programming session 04C programming session 04
C programming session 04
 
venkatesh.pptx
venkatesh.pptxvenkatesh.pptx
venkatesh.pptx
 
Pc module1
Pc module1Pc module1
Pc module1
 
C language presentation
C language presentationC language presentation
C language presentation
 
Concept of c data types
Concept of c data typesConcept of c data types
Concept of c data types
 
04. WORKING WITH FUNCTIONS-2 (1).pptx
04. WORKING WITH FUNCTIONS-2 (1).pptx04. WORKING WITH FUNCTIONS-2 (1).pptx
04. WORKING WITH FUNCTIONS-2 (1).pptx
 
4. function
4. function4. function
4. function
 
qb unit2 solve eem201.pdf
qb unit2 solve eem201.pdfqb unit2 solve eem201.pdf
qb unit2 solve eem201.pdf
 
Interview Questions For C Language
Interview Questions For C Language Interview Questions For C Language
Interview Questions For C Language
 
Aniket tore
Aniket toreAniket tore
Aniket tore
 
C UNIT-3 PREPARED BY M V B REDDY
C UNIT-3 PREPARED BY M V B REDDYC UNIT-3 PREPARED BY M V B REDDY
C UNIT-3 PREPARED BY M V B REDDY
 
Chapter Functions for grade 12 computer Science
Chapter Functions for grade 12 computer ScienceChapter Functions for grade 12 computer Science
Chapter Functions for grade 12 computer Science
 
Unit_5Functionspptx__2022_12_27_10_47_17 (1).pptx
Unit_5Functionspptx__2022_12_27_10_47_17 (1).pptxUnit_5Functionspptx__2022_12_27_10_47_17 (1).pptx
Unit_5Functionspptx__2022_12_27_10_47_17 (1).pptx
 
CS 360 LAB 3 STRINGS, FUNCTIONS, AND METHODSObjective The purpos.docx
CS 360 LAB 3 STRINGS, FUNCTIONS, AND METHODSObjective The purpos.docxCS 360 LAB 3 STRINGS, FUNCTIONS, AND METHODSObjective The purpos.docx
CS 360 LAB 3 STRINGS, FUNCTIONS, AND METHODSObjective The purpos.docx
 
Concept Of C++ Data Types
Concept Of C++ Data TypesConcept Of C++ Data Types
Concept Of C++ Data Types
 

Shanks

  • 1. Function is a self contained block of a statements enclosed between braces that performed a specific tasks or a function is a group of numbers of repeated statements in a program into a single unit and is identified by a name known as function name There may be one or more function in a program but the main function is a essential part of the program. Function can be implemented any where in a program wherever it is needed, so as to prevent repetition of same instructions again and again in the program For example we might use the factorial of a number at different places in a program the same set of instruction for calculating factorial of a number are places in a function
  • 2. Function reduces the size of the program as repetition of instruction is reduced because these are written only once in a function that is instead of writing debugging and compiling the same set of instructions again and again the port can be re used.  Function supports modular programming in which a large program is divided into smaller self contained parts. Each of which as a unique identification which makes the program easy to write understand debugging and maintained.  Function promotes portability of a programs since function writing are independent of system dependent features  Designing of large and complex programs becomes very easy and fast using function. This is because different functions can be involved In which it can be later combined to make the complex program, which results in reduction of time and cost  Different data sets can be transferred to the function ,each time it is invoked which helps in saving a lot of memory space by allowing same set of statements to be used for different set of data  In “c” language ,a function can call it self again ,this is known as
  • 3. 1. Library function 2. User define function  Library function : They are redefined and precompiled that are designed to perform for sum specific task. Information is passed to these functions through arguments and returned through the returned statement. for ex to calculate the square of a number and square root of a number power of a number and length of a string etc.  Some of the library functions are print f, scan f , get character to upper() to lower()  User defined function : They are those functions which programmer writes on his own as per the requirements in the program .So functions which are defined specifically by the user to meet his requirement are called user define function. Every “C” program contains at least one function that is main ( ) every function in “C” consist of following components  (1) function definition  (2) function declaration or function prototype  (3) function call
  • 4. An array is a finite ordered set of homogeneous elements. Arrays is used to handle a large amount of data without the need to declare many individual variables separately. All the array elements must be either of simple data types like integers float character double character etc or they can be any user defined data types like structure and unions
  • 5. These are of three types 1. One dimensional arrays 2. Two dimensional arrays 3. Three or multi dimensional arrays  One dimensional array: An array with one dimension is referred as one dimension array i.e. int a [ ]  Two dimensional array: An array with two dimensional is referred as two dimensional array i.e. int a [ ] [ ]; two dimensional arrays results in a matrix of rows and columns  Three or multi dimensional arrays: An array with more than two dimensions is know as multidimensional array. An array may consist of any number of dimension subjects to the restriction put by a compiler depend upon the language i.e. int a [ 3 ] [ 4 ] [ 5 ]
  • 6. A string is a group of character which can be store in a character array many a time also called a string. A string is a collection of character‟s terminated by a null character „0‟. The null character indicates the end of the string. Each character that compose a string is stored in one dimensional char type array in contiguous memory locations for ex “Try Again” is a collection of character‟s „T‟ „R‟ „Y‟ „A‟ „G‟ „A‟ „I‟ „N‟ and terminated by a null character STRING VARIABLE: It is an array of character's that has a defined length. it can be used to store value #include <stdio.h> #include<conio.h>
  • 7. Int strlen(s): This function takes one argument s which can be a string constant or a string variable. It returns the number of characters in the string s excluding the NULL character („0‟). If string is empty, it return zero.
  • 8. A pointer is a variable that contains the address of another variable in memory. Suppose I is a integer variable having value 10 stored at address 2202 and address of I is assigned to variable j, then j is a pointer variable pointing to memory address stored in it. In other words, j is a pointer variable containing address of I (i.e.2002)  Pointer variable is also known as address variable as it always store address of some other variable.
  • 9. Data-type*ptr-var-name;  Program demonstrate use of pointer variable and address of operator  #include<stdio.h>  #include<conio.h>  main()  {int I,*ptr;  Clrscr();  i=5;  Ptr=&I;/*store address of i*/  Printf(“value of i+%d”,i);  Printf(“n address of i=%u”,$i);  Printf(“nvalue of ptr=%u”‟ptr);  Getch();