◆Unit : 1 User Defined Function
● Function: When a program is divided into small parts, each part is known as function.
● System Defined Function : A function which is defined by system is called system defined function.
● User Defined Function: A function which is defined by user according to the requirement/need is called user defined function
● Modularity : We can divide a large program into multiple small modules. Using functions, it is very easy to understand the program.
● Code Reusability : If we create a function, we can call them multiple times as per our requirement.
● Reduce the Size: Reduces the size of the code, duplicate set of statements are replaced by function calls.
● Easy to find error: We can divide a large program into multiple small modules, it is easy to find out error from it.
● Function Declaration: In this section, we declare a user defined function. We can declare a UDF before void main() function.
● Function Calling: Once user defined function is created, we can call them many times as per our requirement.
● Function Definition: Definition code is actual code of function. Function definition code has set of instruction to perform specific task.
● Categories of Function:
1. No Argument No Return value (NANR)
2. No Argument With Return value (NAWR)
3. With Argument No Return value (WANR)
4 : With Argument With Return value (WAWR)
● Nested Function: When there is a function inside another function is called nested function.
● Recursion: When function calls itself then it is known as recursion.
◆ Unit : 2 Structure
● Structure : Structure is a user defined data type that can store multiple data elements with different data types.
● struct keyword is used to declare a structure.
● We can access structure member using (.) dot operator
● we can assign/initialize structure variable using = (assignment operator)
● array : Array is a collection of data elements with similar data type.
● Union : Union is a user defined data type that has a collection of data elements with different data types.
● union keyword is used to create/declare a union.
◆ Unit : 3 pointer
● Memory: Memory is sequential list of storage cells. 1 storage cell=1 byte.
● Memory Address: Each cell has unique address which is known as Memory Address.
● Pointer: Pointer is a variable that stores memory address of another variable as a value.
● Pointer Advantages:
▪ Pointers are useful for accessing memory locations.
▪ Pointers provide an efficient way for accessing the elements of an array structure.
▪ Pointers are used for dynamic memory allocation as well as deallocation.
▪ Pointers are used to form complex data structures such as linked list, graph, tree,
● Reference operator (&) : stores Memory address of variable
● Dereference operator (*) : stores value of given memory address
● Pointer Expression: We can perform arithmetic operations on Pointer variables using deference operators. We cannot perform arithmetic operations on memory address.
● Scale Factor: When we perform increment or decrement operation on pointer variable then it will be automatically incremented or decremented by its byte size.
● Character : It specifies single character represented in single quote like ‘A’, ‘a’, ‘4’, ‘*’ etc.
● Call by Value: · When we pass actual value of variable in function, then it is known as call by value.
● Call by Reference: · When we pass the address of the variable into the function call as the actual parameter, then it is known as call by reference.
◆ Unit : 4 C File management
● Time Consuming : it takes lot of time to take inputs each time .
● Lost of Data : Data will be lost when progarm is completed /terminated .
● File : File is a place on disk where group of related data are stored .●
● Operations on File
- Creation of a file
- Opening a file
- Reading a file
- Writing to a file
- Closing a file
● fopen() function : fopen() is a system defined function that is used to create a file or open an existing file.
● fclose() function: This function is used to close the file that is being pointed by file pointer fp.
● fputc() function: This function is used to write a single character into a file.
● fgetc() function: This function is used to read a single character from a file.
● fputs() function: This function is used to write a string into a file.
● fgets() function: This function is used to read a string from a file.
● fprintf() function: This function is used to write data into a file.
● fscanf() function: This function is used to read data from a file.
● ftell() function: This function is used to get current position of file pointer.
● rewind() function: This function is used to move file pointer at beginning position.
● fseek() function: This function is used to move the position of file pointer at specific position.