144 Computer Programming 4. An array Index starts with? (b) 0 (a) -1 (d) 2 (c) 1 (b) 2 5. What is the output of C Program? (d) Compiler error int main() { int a[]; a[4] = {1,2,3,4}; printf(\"%d\", a[0]); } (a) 1 (c) 4 Answers: 1. (b), (c), 3. (a), 4. (b), 5. (d) 5.8 References 1. https://beginnersbook.com/2014/01/c-arrays-example/ 2. https://fresh2refresh.com/c-programming/c-array/ 3. https://www.tutorialspoint.com/cprogramming/c_arrays.htm 4. http://ee.hawaii.edu/~tep/EE160/Book/PDF/Chapter9.pdf CU IDOL SELF LEARNING MATERIAL (SLM)
Strings 145 UNIT 6 STRINGS Structure: 6.0 Learning Objectives 6.1 Introduction 6.2 Strings Basics 6.3 Declaring and Initializing String Variables 6.4 String Storage 6.5 Built-in-string functions 6.6 Summary 6.7 Key Words/Abbreviations 6.8 Learning Activity 6.9 Unit End Questions (MCQ and Descriptive) 6.10 References 6.0 Learning Objectives After studying this unit, you will be able to: Describe the concepts of strings Declaring and initialzing the string variables String storage Apply string handling functions CU IDOL SELF LEARNING MATERIAL (SLM)
146 Computer Programming 6.1 Introduction String is an array of characters. In this guide, we learn how to declare strings, how to work with strings in C programming and how to use the pre-defined string handling functions. We will see how to compare two strings, concatenate strings, copy one string to another & perform various string manipulation operations. We can perform such operations using the pre- defined functions of “string.h” header file. In order to use these string functions you must include string.h file in your C program. 6.2 Strings Basics In C programming, array of characters is called a string. A string is terminated by a null character/0. Strings are in fact one-dimensional array of characters. Strings are always enclosed by double quotes. Whereas, character is enclosed by single quotes in C. Example for C String char string[15] = {'s', 'h', 'r', 'u', 't', 'k', 'i', 'r', 't', 'i', '\\0'}; char string[15] = \"shrutkirti\"; char string [] = \"shrutkirti\"; Difference between above declarations are, when we declare char as \"string[20]\", 20 bytes of memory space is allocated for holding the string value. When we declare char as \"string[]\", memory space will be allocated as per the requirement during execution of the program. A string in the C language is simply an array of characters. Strings must have a NULL or \\0 character after the last character to show where the string ends. A string can be declared as a character array or with a string pointer. First we take a look at a character array example: char mystr[15]; As you can see the character array is declared in the same way as a normal array. This array can hold only 14 characters, because we must leave room for the NULL character #include <stdio.h> int main() CU IDOL SELF LEARNING MATERIAL (SLM)
Strings 147 { char name[15]; printf(\"Enter name: \"); scanf(\"%s\", name); printf(\"Your name is %s.\", name); return 0; } Output: Enter name Shrutkirti Your name is Shrutkirti 6.3 Declaring and Initializing String Variables Consider the following declaration and initialization that creates a string consisting of the word \"Program\". To hold the null character at the end of the array, the size of the character array containing the string is one more than the number of characters in the word \"Programming\" char word[8] = {'P', 'r', 'o', 'g', 'r', 'a', 'm', '\\0'}; The above array can also be initialized as follows char word[] = \"Program\"; 6.4 String Storage Index 0 1 2 3 4 5 6 7 Array P r o g r a m \\0 Memory location 7890 7891 7892 7893 7894 7895 7896 7897 Fig. 6.1: Contents of the character array The null character automatically places the \\0 character at the end of the string when it's initialized in the array. CU IDOL SELF LEARNING MATERIAL (SLM)
148 Computer Programming Example: void main() { char word[8] = {'P', 'r', 'o', 'g', 'r', 'a', 'm', '\\0'}; printf(\"Message = %s\", word ); } Output: Message = Program Global and Local Variables A local variable is declared inside a function. A global variable is declared outside all functions. A local variable can only be used in the function where it is declared. A global variable can be used in all functions. ##include<stdio.h> // Global variables int x; int y; int add() { return x + y; } int main() { int answer; // Local variable x = 2; y = 5; CU IDOL SELF LEARNING MATERIAL (SLM)
Strings 149 answer = add(); printf(“%d\\n”,answer); return 0; } In example, global variables are declared, x and y. These variables can be used in main() and add(). The local variable answer can only be used in main(). 6.5 Built-in-string-Functions string.h or strings.h The C language provides no explicit support for strings in the language itself. The string- handling functions are implemented in libraries. String I/O operations are implemented in <stdio.h> (puts , gets, etc). A set of simple string manipulation functions are implemented in <string.h>, or on some systems in <strings.h>. There is a separate header file that handles String in C Programming named \"string.h\". It provides a wide range of functions that manipulate a null-terminated string. strcpy() function This library function is used to copy a string and can be used like this: strcpy(destination, source). (It is not possible in C to do this: string1 = string2). Take a look at the following example: str_one = \"shruti\"; str_two = \"kirti\"; strcpy(str_one , str_two); // str_one becomes \"kirti\" Note: strcpy() will not perform any boundary checking, and thus, there is a risk of overrunning the strings. strcmp() function This library function is used to compare two strings and can be used like this: strcmp(str1, str2). If the first string is greater than the second string a number greater than null is returned. If the first string is less than the second string a number less than null is returned. If the first and the second string are equal a null is returned. CU IDOL SELF LEARNING MATERIAL (SLM)
150 Computer Programming Take look at an example: printf(\"Enter you name: \"); scanf(\"%s\", name); if( strcmp( name, \"Shruti\" ) == 0 ) printf(\"Hello, Shruti!\\n\"); Note: strcmp() will not perform any boundary checking, and thus, there is a risk of overrunning the strings. strcat() function This library function concatenates a string onto the end of the other string. The result is returned. Take a look at the example: printf(\"Enter you age: \"); scanf(\"%s\", age); result = strcat( age, \" years old.\" ) == 0 ) printf(\"You are %s\\n\", result); Note: strcat() will not perform any boundary checking, and thus, there is a risk of overrunning the strings. strlen() function This library function returns the length of a string. (All characters before the null termination.) Take a look at the example: name = \"Shruti\"; result = strlen(name); //Will return size of six. memcmp() function This library function compares the first count characters of buffer1 and buffer2. The function is used like this: memcmp(buffer1,buffer2). The return values are as follows: If buffer1 is greater than buffer2 a number greater than null is returned. If buffer1 is less than buffer2 a number less than null is returned. If buffer1 and buffer2 are equal a null is returned. CU IDOL SELF LEARNING MATERIAL (SLM)
Strings 151 Note: There are also library functions: memcpy, memset and memchr. strlwr() function strlwr( ) function converts a given string into lowercase. Syntax for strlwr( ) function is given below. char *strlwr(char *string); In this program, string \"MODIFY This String To LOwer\" is converted into lower case using strlwr( ) function and result is displayed as \"THIS IS CAPITAL STRING\". #include<stdio.h> #include<string.h> int main() { char str[ ] = \" THIS IS CAPITAL STRING \"; printf(\"%s\\n\",strlwr (str)); return 0; } Output: modify this string to lower strupr() function strupr( ) function converts a given string into uppercase. Syntax for strupr( ) function is given below. char *strupr(char *string); In this program, string is converted into uppercase using strupr( ) function and result is displayed as \"THIS IS LOWER CASE STRING\". #include<stdio.h> #include<string.h> int main() { CU IDOL SELF LEARNING MATERIAL (SLM)
152 Computer Programming char str[ ] = \"This is lower case string\"; printf(\"%s\\n\",strupr(str)); return 0; } Output: MODIFY THIS STRING TO UPPER strrev() function strrev( ) function reverses a given string in C language. Syntax for strrev( ) function is given below: char *strrev(char *string); In below program, string \"Shrutkirti\" is reversed using strrev( ) function and output is displayed as \"itrikturhS\". #include<stdio.h> #include<string.h> int main() { char name[25] = \" Shrutkirti \"; printf(\"String before strrev( ) : %s\\n\",name); printf(\"String after strrev( ) : %s\",strrev(name)); return 0; } Output: String before strrev( ) : Shrutkirti String after strrev( ) : itrikturhS CU IDOL SELF LEARNING MATERIAL (SLM)
Strings 153 Table 6.1: List of String Functions Sr. No. String Function Description 1 strcpy(s1, s2); Copies string s2 into string s1 2 strcat(s1, s2); Concatenates string s2 onto the end of string s1 3 strlen(s1); Returns the length of string s1 4 strcmp(s1, s2); Returns 0 if s1 and s2 are the same; less than 0 if s1<s2; greater than 0 if s1>s2. 5 strchr(s1, ch); Returns a pointer to the first occurrence of character ch in string s1 6 strstr(s1, s2); Returns a pointer to the first occurrence of string s2 in string s1 7 strrchr ( ) Returns last occurrence of given character in a string is found 8 strrstr ( ) Returns pointer to last occurrence of str2 in str1 9 strdup ( ) Returns Duplicates the string 10 strlwr ( ) It Converts string to lowercase 11 strupr ( ) It Converts string to uppercase 12 strrev ( ) Returns Reverses the given string 13 strset() Returns Sets all character in a string to given character 14 strnset() It sets the portion of characters in a string to given character 15 strtok() Tokenizing given string using delimiter Consider the following example that demonstrates some of the above mentioned methods #include<string.h> #include<stdio.h> #include<conio.h> void main() { char msg1[10] = \"Good\"; //String one char msg2[10] = \"morning\"; //String two char msg3[15]; //String three to hold the result //original strings CU IDOL SELF LEARNING MATERIAL (SLM)
154 Computer Programming printf(\"\\n\\nOriginal Messages:\\n\"); printf(\"\\nMsg1 : %s\",msg1); printf(\"\\nMsg2 : %s\",msg2); //copy string strcpy(msg3,msg2); printf(\"\\n\\nMessages after copying:\\n\"); printf(\"\\nMsg1 : %s\",msg1); printf(\"\\nMsg2 : %s\",msg2); printf(\"\\nMsg3 : %s\",msg3); printf(\"\\n\\nLength of Messages before concatenation:\\n\"); printf(\"\\nMsg1 : %d\", strlen(msg1)); printf(\"\\nMsg2 : %d\", strlen(msg2)); //string concatenation strcat(msg1,msg2); printf(\"\\n\\nMessages after concatenation:\\n\"); printf(\"\\nMsg1 : %s\",msg1); printf(\"\\nMsg2 : %s\",msg2); printf(\"\\n\\nLength of Messages after concatenation:\\n\"); printf(\"\\nMsg1 : %d\", strlen(msg1)); printf(\"\\nMsg2 : %d\", strlen(msg2)); getch(); } Output: Original Message Msg1 : Good Msg2 : Morning CU IDOL SELF LEARNING MATERIAL (SLM)
Strings 155 Messages after copying Msg1 : Good Msg2 : Morning Msg3 : Morning Length of Messages before concatenation Msg1 : 4 Msg2 : 7 Messages after concatenation Msg1 : GoodMorning Msg2 : Morning Length of Messages after concatenation Msg1 : 11 Msg2 : 7 6.6 Summary Strings are actually one-dimensional array of characters terminated by a null character ‘\\0’. Thus a null-terminated string contains the characters that comprise the string followed by a null. Strings are defined as an array of characters. The difference between a character array and a string is the string is terminated with a special character ‘\\0’. 6.7 Key Words/Abbreviations C STRING FUNCTIONS: String.h header file supports all the string functions in C language. All the string functions are given below. 1. strcat ( ) - Concatenates str2 at the end of str1 2. strcpy ( ) - Copies str2 into str1 3. strlen ( ) - Gives the length of str1 CU IDOL SELF LEARNING MATERIAL (SLM)
156 Computer Programming 4. strcmp ( ) - Returns 0 if str1 is same as str2. Returns <0 if strl < str2. Returns >0 if str1 > str2 5. strcmpi ( ) - Same as strcmp() function. But, this function negotiates case. “A” and “a” are treated as same. 6. strchr ( ) - Returns pointer to first occurrence of char in str1. 7. strrchr ( ) - last occurrence of given character in a string is found 8. strstr ( ) - Returns pointer to first occurrence of str2 in str1 9. strrstr ( ) - Returns pointer to last occurrence of str2 in str1 10. strdup ( ) - Duplicates the string 11. strlwr ( ) - Converts string to lowercase 12. strupr ( ) - Converts string to uppercase 13. strrev ( ) - Reverses the given string 14. strset ( ) - Sets all character in a string to given character 15. strtok ( ) - Tokenizing given string using delimiter 6.8 Learning Activity 1. Write a program in C to print a string. ....................................................................................................................................... ....................................................................................................................................... 2. Write a program in C to sort string characters. ....................................................................................................................................... ....................................................................................................................................... 3. Write a program in C to find length of the string without function. ....................................................................................................................................... ....................................................................................................................................... 4. Write a program in C to concatenate two strings. ....................................................................................................................................... ....................................................................................................................................... CU IDOL SELF LEARNING MATERIAL (SLM)
Strings 157 6.9 Unit End Questions (MCQ and Descriptive) A. Descriptive Type: Short Answer Type Questions 1. What is string? How is it declared? What happens in memory? 2. Explain the various types of string functions with example. 3. Write a program in C to compare two strings. 4. Write a program in C to accept the string from user & print length of the string. 5. Write a program in C to accept string from user and copy that string into another string. 6. Write a program in C to accept two strings from user and combine both of the strings and print combined string. 7. Write a program in C to accept the string from user and print whether it is palindrome or not. 8. Explain string header files in C programming language. B. Multiple Choice/Objective Type Questions 1. Which of the following function sets first n characters of a string to a given character? (a) strinit() (b) strnset() (c) strset() (d) strcset() 2. If the two strings are identical, then strcmp() function returns (a) -1 (b) 1 (c) 0 (d) Yes 3. The library function used to find the last occurrence of a character in a string is (a) strnstr() (b) laststr() (c) strrchr() (d) strstr() 4. Which of the following function is more appropriate for reading in a multi-word string? (a) printf(); (b) scanf(); (c) gets(); (d) puts(); CU IDOL SELF LEARNING MATERIAL (SLM)
158 Computer Programming 5. What will be the output of the following C code? #include <stdio.h> int main() { char *str = \"hello, world\\n\"; printf(\"%d\", strlen(str)); } (a) Compilation error (b) Undefined behaviour (c) 11 (d) 13 Answers: 1. (b), 2. (c), 3. (c), 4. (c), 5. (d) 6.10 References 1. https://www.tutorialspoint.com/learn_c_by_examples/string_programs_in_c.htm 2. https://beginnersbook.com/2014/01/c-strings-string-functions/ 3. https://www.programiz.com/c-programming/c-strings 4. C Programming Language written by Dennis Ritchie and Brian W. Kernighan. CU IDOL SELF LEARNING MATERIAL (SLM)
Functions 159 UNIT 7 FUNCTIONS Structure: 7.0 Learning Objectives 7.1 Introduction 7.2 Concepts of User Defined Function 7.3 Function Prototype (Declaration) and Definition 7.4 Return Statement 7.5 Calling a Function by Passing Values 7.6 Recursive Function 7.7 Summary 7.8 Key Words/Abbreviations 7.9 Learning Activity 7.10 Unit End Questions (MCQ and Descriptive) 7.11 References 7.0 Learning Objectives After studying this unit, you will be able to: Explain the concepts of functions Describe different types of functions Discuss recursive functions Discuss Attributes of functions CU IDOL SELF LEARNING MATERIAL (SLM)
160 Computer Programming Discuss Prototype of Function Diffferent way of calling the Function 7.1 Introduction A function is a block of statements that performs a specific task. Suppose you are building an application in C language and in one of your program, you need to perform a same task more than once. In such case you have two options – (a) Use the same set of statements every time you want to perform the task. (b) Create a function to perform that task, and just call it every time you need to perform that task. Using option (b) is a good practice and a good programmer always uses functions while writing codes in C. 7.2 Concepts of User Defined Function Functions are a set of block of statement to avoid repetitive task. Dividing a program into functions is the major principle of top-down structured programming. It also reduces the size of the program when function is called many times or can be called at different places. Since function will be defined to put repetitive statements to perform a task and then function can be called at places wherever we need to execute that task. Different uses of Functions used in C 1. C functions are used to avoid rewriting the same block of statements, which are to be executed again and again. 2. Functions can be called as many times as required. No limitation on calling of a function. 3. Defining function specifies modularization which divides large C programs into functions,. i.e., dividing big task into small parts to achieve functionality. 4. The core concept of modularization that means dividing program into functions is reusability. CU IDOL SELF LEARNING MATERIAL (SLM)
Functions 161 5. Modification can be done easily because of modularization. Updatation does not affect whole program only respective module will be affected. Categories of Functions C functions can be classified into two categories, Library functions User-defined functions Library functions are those functions which are defined by C library, example printf(), scanf(), strcat() etc. Every C Program has main() function inbuilt in the program with return type int or void which is function header statement. Consist of main function definition with function body comprises of atatements terminated by; sign and user defined functions can be added according to the requirement. 7.3 Function Prototype (Declaration) and Definition 7.3.1 Defining a Function Function Definition: return_type function name (no. of parameters/arguments with data types) { c statement; // Block code of statements // c statement; return statement; } Return_type: Every function returns a value after execution of block of statements, Return type can be of any data type such as int, double, char, void, short, etc., Normally, function return type is any datatype but if function does not return any value then we have to specify with void keyword to indicate function returns null value. CU IDOL SELF LEARNING MATERIAL (SLM)
162 Computer Programming Function_name: Function name should be valid identifier and function name should be a meaningful name so that it can be easy to understand the purpose of function just by seeing its name. Argument list/parameter list (type arg1, type arg2): Arguments are also called parameters, parameter list contains variables names along with their data types. These arguments are positional formal/dummy parameters whose value can be replaced with actual parameter during function call. For example – A function which is used to add three integer variables, will have three integer argument. All arguments are to be specified along with data type and are separated by commas. Block of code: It is a Set or Block of C statements, which will be executed during function call. Function definition execution will be performed in a stack. If function has return type, then return statement will be the last statement of a block and if function has no return type, i.e., void then this function will have a no return statement. Let us Assume on example to solve the problem of function Problem 1: Write a Function for addition of two numbers Solution: Function Definition of sum of two numbers with Return type: int sum (int a, int b) { int c; c = a + b; return c; } Problem 2: Write a Function to print entered number in even or odd Solution:. Function definition of even number checking with No return type hence void: void even (int a) { CU IDOL SELF LEARNING MATERIAL (SLM)
Functions 163 if (a%2 = = 0) printf(“a is even”); else printf(“a is odd”); } Example: /* function return type is void and doesn’t have parameters*/ void main() { /*calling function*/ intro(); getch(); } void intro() { printf(“Hi\\n”); printf(“My name is Kiran Gurbani\\n”); printf(“How are you?”); /* there is no return statement inside this function, since its * return type is void */ } Output: Hi My name is Kiran Gurbani How are you? CU IDOL SELF LEARNING MATERIAL (SLM)
164 Computer Programming Pictorial representation of function call accessed by function definition and returing value back to main function. Fig. 7.1: Pictorial representation of function call accessed by function definition and returing value back to main function 7.3.3 Function Prototypes Function Prototypes 1. Function prototype is the signature of the function also called a function declaration. 2. Function declaration informs to the compiler about return type of the function, name of the function and list of arguments with their data types. Examples of function prototype statement or function declaration Function with three integer arguments and integer as return type is represented using below syntax int sum(int,int, int);, int c); OR int sum( int a, int b, int c); Function with integer argument and integer as return type is represented using below syntax int cube(int); In the below example we have written function with no argument and no return type void display(void); CU IDOL SELF LEARNING MATERIAL (SLM)
Functions 165 In below example we have declared function with no argument and integer as return type int get(void); Case 1: Function definition written before main function In this case we are defining function before main function, hence function declaration is not needed. It is optional. #include<stdio.h> #include<conio.h> void display() { printf(“Hello, Welcome to Kiran\\n”); printf(“ How are you”); } void main() { display(); getch(); } Case 2: Function definition written after main function In this case we are defining function after main funiction, hence function declaration is compulsory to be specified in the global declaration or local declaration before main function. #include<stdio.h> #include<conio.h> // Function Prototype Declaration int sum(int a, int b); void main() { CU IDOL SELF LEARNING MATERIAL (SLM)
166 Computer Programming int x,y,s; clrscr(); printf(“Enter two numbers\\n”); scanf(“%d %d”,&x,&y); s=x+y; printf(“\\n The sum of two numbers is %d”,s); getch(); } int sum(int a, int b) { int c; c= a+b; return c; } 7.3.4 Passing Arguments to a Function and Specifying Argument Data Type Arguments are the parameters that are passed to a function definition, function call and function declaration. These parameters or arguments are local to a function, the scope of these arguments is valid within a function itself, outside function, it cannot be executed, hence these local arguments value is to be passed to formal positional parameters of the function. Arguments can be passed to functions and functions always return one value 1. If function returns only one single value then function must have return data type compulsory. Example: Sum of three numbers, Factorial of a number, these functions having return value by function, will be single. 2. If function returns more than one values or if through function we are going to print any message then in both the cases function does not have any return type because CU IDOL SELF LEARNING MATERIAL (SLM)
Functions 167 function cannot return more than one value and we cannot return message hence function will not have any return type. By using pointers we can achieve this. Example: Print number is even or odd, print number is prime or not, print natural numbers from 1 to 10, print prime numbers from 1 to n. 3. Function with argument return multiple values using function using pointers. 1. Functions with arguments with return type In this type when function is called within a main function then function can send arguments from the calling function to the called function and wait for the result to be returned back from the called function back to the calling function. The argument values will be evaluated by called function and result will be returned to calling function. This program has sum as a user defined function, during the call of this function values of x and y are passed from calling function to user defined function sum into a and b variables. The result of addition will be stored in r variable within called function and return back to calling function and stored in z variable. Further processing of printing of result will be done in main function. Example of sum of two numbers using function #include<stdio.h> #include<conio.h> void main() { int sum(int, int); int x,y,z; clrscr(); printf(“Enter two numbers\\n”); scanf(“%d %d”,&x, &y); z = sum(x,y); CU IDOL SELF LEARNING MATERIAL (SLM)
168 Computer Programming printf(“\\nThe sum of two numbers is %d.”,z); getch(); } int add(int a, int b) { int r; r = a+b; return r; } 2. Functions with arguments no return type due to message returning In this type when a function is called within a main function then function can send arguments from the calling function to the called function. The argument values will be evaluated by called function and the result will be displayed within the user defined function. Called function will not return anything to calling function since function does not return any value. In this program during call of this function values of x is passed from calling function to user defined function even into a variable, then evaluation of variable a will be done in function definition and result message will be printed in function definition. #include<stdio.h> #include<conio.h> void even(int n); void main() { int x; clrscr(); printf(“Enter a number\\n”); scanf(“%d”,&x); even(x); CU IDOL SELF LEARNING MATERIAL (SLM)
Functions 169 getch(); } void even(int n) { If(n % 2 ==0) printf(“*n=%d is even number “,n); else printf(“n = %d is odd number”,n); } c of the function with arguments and no return value. 3. Functions with arguments no return type due to returning of multiple values In this type when function is called within main function then function can send argument from the calling function to the called function The argument values will be evaluated by called function and the result will be displayed within user defined function. Called function will not return anything to calling function since function does not return any value. In this program during call of this function, value of x is passed from calling function to user defined function into a variable, then evaluation of variable a will be done in function definition and result message will be printed in function definition, since function is returning multiple values. #include<stdio.h> #include<conio.h> void natural(int x); void main() { int x; clrscr(); printf(“Enter a number\\n”); scanf(“%d”,&x); natural(x); CU IDOL SELF LEARNING MATERIAL (SLM)
170 Computer Programming getch(); } void natural(int n) { int i; for( i=1;i<=n;i++) { printf(“%d”,i); } } Pictorial representation of the function with arguments and no return value because of multiple values returning. 4. Functions with arguments that return multiple values So far, we have learned and seen that in a function, return statement was able to return only a single value. That is because; a return statement can return only one value. But if we want to send back more than one value then how could we do this? For that we have to use pointers What are pointers? A pointer is a variable that represents the location (rather than the value) of a data item in memory, such as a variable or an array element. Pointer is a very useful tool of C programming as it can help improve the programs efficiency and allow the user to handle unlimited amount of data. Pointers are also closely associated with arrays and, therefore, provide an alternate way to access individual array elements. Variable are stored in the memory in one or more contiguous memory location. This depends on the type of data. For example, a single char is stored in one byte of memory, an integer variable will be stored in two bytes and floating point may require four contiguous memory locations. Let’s consider a variable x. compiler immediately assigns a memory location after the variable declaration. The address of variable x can be accessed using the expression &x, where & is a unary CU IDOL SELF LEARNING MATERIAL (SLM)
Functions 171 operator called address operator, that evaluates the address of its operand. Now suppose the address of x is assigned to another variable, px, i.e., px = &x; This new variable, px, is called a pointer to x because it points to the location where x is stored in memory. Thus px is referred to as pointer variable. The data item identified by x can also be accessed by the expression *px, where * is a unary operator that operates on only a pointer variable. Therefore, *px and x both identify the same data. The relationship between px and x is shown in the diagram below: Address of x Value of x px x Fig. 7.2: Pictorial Representation of Relationship between Pointer Variable and Variable Defining a Pointer The syntax for pointer declaration is data-type *pt_var where pt_var is the name of the pointer variable and data-type refers to the data type of the pointer. (Note: Remember that an asterisk must precede pt_var) For example, consider the following snippet for pointer declaration int x, y; //integer variable declaration int *ptr_x; // integer pointer declaration The variable ptr_x is declared as pointer variable that can point to a integer quantity. Note that ptr_x represents an address, not a floating-point quantity. Pointer Initialization and Pointer Assignment A pointer variable can be initialized by assigning it the address of another variable during pointer variable declaration. Remember that the variable whose address is assigned to the pointer variable must have been declared earlier in the program: Consider the following pointer declaration int x, y; //integer variable declaration int *ptr_x = &x; //integer pointer declaration and initialization CU IDOL SELF LEARNING MATERIAL (SLM)
172 Computer Programming We have used arguments to send values to the called function, in the same way we can also use arguments to send back information to the calling function. The arguments that are used to send back data are called Output Parameters. It is a bit difficult for a novice because this type of function uses a pointer. Let’s see an example: #include<stdio.h> #include<conio.h> void main() { int len,br,area,peri; void areaperi(int l,int b,int *area,int *peri); clrscr(); printf(“Enter length & breath\\n”); scanf(“ %d %d”,&len,&br, &area, &peri); printf(“Area is %d”,*area); printf(“permeter is %d”, *peri); getch(); } void areaperi(int l, int b, int *area, int *peri) { *area = l * b; *peri = 2*(l+b); } Parameters are of two types Formal arguments: While declaring a function, ie while specifying function prototype or providing function signature, the arguments list of parameters we specify are known as formal parameters. These formal parameters are also called dummy parameters and they are local variables CU IDOL SELF LEARNING MATERIAL (SLM)
Functions 173 to a function also they are called as positional parameters, since their postion is fixed when passed within a function. While passing formal parameters we have to specify data types. Actual arguments: The parameter’s value (or arguments) we provide while calling a function is known as actual arguments. These arguments are original or actual values of parameters which is to be passed during function call. Actual parameters are also positional parameters. While passing actual parameters we have to pass values of variables but we don’t have to pass data type of parameters, we have to pass only arguments or its value. For example Example of C program containing a function that alters the value of its argument. #include <stdio.h> void modify ( int a); /* function prototype */ void main ( ) { int a = 2; printf( “ \\n a = %d (from main, before calling the function ) “, a ); modify(a); printf( “ \\n a = %d (from main, after callig the function) “, a ) ; getch(); } void modify (int a) { a *= 3; printf ( “ \\n a = %d (from the function, after being modified)”, a ) ; return; } The value of a variable is assigned with value is 2, original value of a (i.e., a = 2) is displayed when main begins execution. This value is then passed to the function modify, i.e., actual parameter a value will be passed to formal parameter of modify function, where it is multiplied by 3 in modify CU IDOL SELF LEARNING MATERIAL (SLM)
174 Computer Programming function and the new value displayed after modification since function does not have return value. Note that it is the altered value of the formal argument that is displayed within the function. Finally, the value of a within main (i.e., the actual argument) is again displayed, after control is transferred back to main from modify. When the program is executed, the following output is generated. a = 2 (from main, before calling the function) a = 6 (from the function, after being modified) a = 2 (from main, after calling the function) These results show that a is not altered within main, even though the corresponding value of a is changed within modify. Passing an argument by value has the following advantages and disadvantages : Advantage: It allows a single valued actual argument to be written as an expression rather than being restricted to a single variable. Moreover, if the actual argument is expressed simply as a single variable, it protects the value of this variable from alterations within the function. Disadvantage: It does not allow information to be transferred back to the calling portion of the program via arguments. Thus, passing by value is restricted to a one-way transfer of information. Fig. 7.3: Pictorial Representation of Formal and Actual Partameters CU IDOL SELF LEARNING MATERIAL (SLM)
Functions 175 7.4 Return Statement Like variable and an array, a function must also be declared before it is called. A function declaration tells the compiler about a function name and how to call the function. Function Definition 1. Function Definition is a body of the function written outside the main function. 2. The function definition has a function header statement with a body of statements enclosed within { and } 3. Function definition has two main components: (1) First Line Function Header (2) Body of function enclosed with { } 4. The First Header statement consists of type specification of the value returned by the function followed by function name and followed by ( ) 5. Within ( ) round brackets either can be empty or it can have parameters or arguments with data type of each argument The Syntax of function definition is: return_type function_name (no. of parameters/arguments with data types) { c statement; // Block code of statements // c statement; return statement; } Return_type: Every function returns a value after execution of block of statements, Return type can be of any data type such as int, double, char, void, short etc. Normally function return type is any datatype but if function does not return any value then we have to specify with void keyword to indicate function returns null value. Function_name: Function name should be valid identifier and function name should be a meaningful name so that it can be easy to understand the purpose of function just by seeing its name. CU IDOL SELF LEARNING MATERIAL (SLM)
176 Computer Programming Argument list/parameter list (type arg1, type arg2): Arguments are also called parameters, parameter list contains variables names along with their data types. These arguments are positional formal/dummy parameters whose value can be replaced with actual parameter during function call. For example – A function which is used to add three integer variables, will have three integer argument. All arguments are to be specified along with data type and are separated by commas. Block of code: It is a Set or Block of C statements, which will be executed during function call. Function definition execution will be performed in a stack. If function has return type, then return statement will be the last statement of a block and if function has no return type, i.e., void then this function will have a no return statement. Let us assume on example to solve the problem of function. Function Definition of sum of two numbers with Return type: int sum (int a, int b) { int c; c = a + b; return c; } Function definition of even number checking with no return type hence void: void even (int a) { if (a%2 = = 0) printf(“a is even”); else printf(“a is odd”); } CU IDOL SELF LEARNING MATERIAL (SLM)
Functions 177 Functions with arguments with return type In this type when function is called within a main function then function can send arguments from the calling function to the called function and wait for the result to be returned back from the called function back to the calling function. The argument values will be evaluated by called function and result will be returned to calling function. This program has sum as a user defined function, during the call of this function values of x and y are passed from calling function to user defined function sum into a and b variables. The result of addition will be stored in r variable within called function and return back to calling function and stored in z variable. Further processing of printing of result will be done in main function. Example of sum of two numbers using function #include<stdio.h> #include<conio.h> void main() { int sum(int, int); int x,y,z; clrscr(); printf(“Enter two numbers\\n”); scanf(“%d %d”,&x, &y); z = sum(x,y); printf(“\\nThe sum of two numbers is %d.”,z); getch(); } int add(int a, int b) { int r; r = a+b; CU IDOL SELF LEARNING MATERIAL (SLM)
178 Computer Programming return r; } Pictorial representation of function with arguments and return type. Functions with arguments that return multiple values So far, we have learned and seen that in a function, return statement was able to return only a single value. That is because; a return statement can return only one value. But if we want to send back more than one value then how could we do this? We have used arguments to send values to the called function, in the same way we can also use arguments to send back information to the calling function. The arguments that are used to send back data are called Output Parameters. It is a bit difficult for a novice because this type of function uses a pointer. Let’s see an example: #include<stdio.h> #include<conio.h> void main() { int len,br,area,peri; void areaperi(int l,int b,int *area,int *peri); clrscr(); printf(“Enter length & breath\\n”); scanf(“ %d %d”,&len,&br, &area, &peri); printf(“Area is %d”,*area); printf(“permeter is %d”, *peri); getch(); } void areaperi(int l, int b, int *area, int *peri) { CU IDOL SELF LEARNING MATERIAL (SLM)
Functions 179 *area = l * b; *peri = 2*(l+b); } 7.5 Calling a Function by Passing Values In C programming language call by value and call by reference (also known as pass-by-value and pass-by-reference). These methods are different ways of passing (or calling) data to functions. In call by value while In call by reference while Call by value and call by reference function parameters can be passed by two ways: 1. Call by value (function call we pass values of variables) 2. Call by reference (function call we pass reference or address of variables) Call by Value If data is passed by value, the data is copied from the variable used in for example main() to a variable used by the function. So if the data passed (that is stored in the function variable) is modified inside the function, the value is only changed in the variable used inside the function. Let’s take a look at a call by value example: 1. Call by value: Function call has number of different parameters, the value of these parameters is passed to formal parameters hence the value of actual parameters passed to formal parameters are called call by value. In this function call passes arguments by value. The called function creates a new set of variables. Function prototype statement is: void call_by_value(int x) Function call statement is: call_by_value(a); Function definition is: void call_by_value(int x) { CU IDOL SELF LEARNING MATERIAL (SLM)
180 Computer Programming printf(“Inside call_by_value x = %d before adding 10.\\n”, x); x += 10; printf(“Inside call_by_value x = %d after adding 10.\\n”, x); } Program: # include <stdio.h> void call_by_value(int x) { printf(“Inside call_by_value x = %d before adding 10.\\n”, x); x += 10; printf(“Inside call_by_value x = %d after adding 10.\\n”, x); } void main() { int a=20; printf(“a = %d before function call_by_value.\\n”, a); call_by_value(a); printf(“a = %d after function call_by_value.\\n”, a); getch(); } The output of the program: a = 10 before function call_by_value. Inside call_by_value x = 20 before adding 10. Inside call_by_value x = 30 after adding 10. a = 20 after function call_by_value. In the main() we create a variable of integer type that has the value of 0. Starting value of a we are printing then function call_by_value is called and we input the variable a. This variable (a) is CU IDOL SELF LEARNING MATERIAL (SLM)
Functions 181 then copied to the function variable x. In the function we add 10 to x (and also call some print statements). Then when the next statement is called in main() function the value of variable a is printed. We can see that the value of variable a isn’t changed by the call of the function call_by_value(). 2. Call by reference: In this function, declaration and definition parameters are passed by reference. In this formal parameters of function definition become aliases to the actual arguments in the calling function. The call by reference method of passing arguments to a function copies the address of an argument into the formal parameter. Inside the function, the address is used to access the actual argument used in the call. It means the changes made to the parameter affect the passed argument. To pass a value by reference, argument pointers are passed to the functions just like any other value. So accordingly you need to declare the function parameters as pointer types as in the following function swap(), which exchanges the values of the two integer variables pointed to, by their arguments. The pointer variables are to be specified in function declaration and function definition. /* function definition to swap the values */ void swap(int *a, int *b) { int temp; temp = *a; /* save the value at address a */ *a = *b; /* put b into a */ *b = temp; /* put temp into b */ Return } Let us now call the function swap() by passing values by reference as in the following example #include <stdio.h> /* function declaration */ void swap(int *a, int *b); void main () CU IDOL SELF LEARNING MATERIAL (SLM)
182 Computer Programming { /* local variable definition */ int x = 10; int y = 20; printf(“Before swap, value of x : %d\\n”, x ); printf(“Before swap, value of y : %d\\n”, y ); /* calling a function to swap the values. * &x indicates pointer to x ie. address of variable x and * &y indicates pointer to y ie. address of variable y. */ swap(&x, &y); printf(“After swap, value of x : %d\\n”, x ); printf(“After swap, value of y : %d\\n”, y ); getch(); } Output: Before swap, value of x :10 Before swap, value of y :20 After swap, value of x :20 After swap, value of y :10 7.6 Recursive Function Recursion is a process by which a function calls itself repeatedly, until some specified condition has been satisfied. Function calling itself is Recursion. The process is used for repetitive computations in which each action is stated in terms of a previous result. In C, Recursion is a programming technique that allows the programmer to express operations in terms of themselves. CU IDOL SELF LEARNING MATERIAL (SLM)
Functions 183 Recursion is a process by which action calls itself repeatedly, until some specified condition has been satisfied. The process is used for repetitive computations in which each action is stated in terms of a previous result. It is similar to looping. On the other hand, recursion makes it easier to express ideas in which the result of the recursive call is necessary to complete the task. A simple example of recursion would be: void recurse() { recurse(); /* Function calls itself */ } int main() { recurse(); /* Sets off the recursion */ return 0; } This program will not continue forever, however. The computer keeps function calls on a stack and once too many are called without ending, the program will crash. Recursive Function Statem ents TRUE Condition FALSE Remaining Statem ents STOP Fig. 7.4: Flowchart Showing Recursion CU IDOL SELF LEARNING MATERIAL (SLM)
184 Computer Programming Example: /* calculate the factorial of an integer quantity using recursion */ #include<stdio.h> long int factorial(int n); / * function prototype */ void main( ) { int n; long int factorial(int n); /* read in the integer value */ scanf(“‘%ld”, &n) ; / * calculate and display the factorial */ printf(“n! = %ld\\n”, factorial(n)); getch(); } /* function definition */ long int factorial(int n) / * calculate the factorial */ { if (n <= 1) return( 1 ) ; else return(n * factorial(n - 1)); } The main portion of the program simply reads the integer quantity n and then calls the long- integer recursive function factorial. The function factorial calls itself recursively, with an actual argument (n - 1) that decreases in magnitude for each successive call. The recursive calls terminate when the value of the actual argument becomes equal to 1. CU IDOL SELF LEARNING MATERIAL (SLM)
Functions 185 Recursive Method factorial(n) n=1 Yes Not factorial=1 fact=n*factorial(n–1) return fact Fig. 7.5: Flowchart to Calculate Factorial of an Integer Quantity using Recursion When the program is executed, the function factorial will be accessed repeatedly, once in main and (n - 1) times within itself, though the person using the program will not be aware of this. Only the final answer will be displayed; for example, n! = 3628800 When a recursive program is executed, the recursive function calls are not executed immediately. Rather, they are placed on a stack until the condition that terminates the recursion is encountered.* The function calls are then executed in reverse order, as they are “popped” off the stack. Thus, when evaluating a factorial recursively, the function calls will proceed in the following order: n! = n x (n - l)! (n - l)! = (n - 1) x (n -2)! (n - 2)! = (n - 2) x (n - 3)! 2! =2 x l! CU IDOL SELF LEARNING MATERIAL (SLM)
186 Computer Programming The actual values will then be returned in the following reverse order: l! = 1 2! = 2 x l! = 2 x 1 = 2 3! = 3 x 2! = 3 x 2 =6 4! = 4 x 3! = 4 x 6 = 24 n!= n x (n- l)! = * - - This reversal in the order of execution is a characteristic of all functions that are executed recursively. Fig. 7.6: Reversal in the Order of Execution If a recursive function contains local variables, a set of local variables will be created during each call. The names of the local variables will, of course, always be the same, as declared within the function. However, the variables will represent a different set of values each time the function is executed. CU IDOL SELF LEARNING MATERIAL (SLM)
Functions 187 Each set of values will be stored on the stack, so that they will be available as the recursive process “unwinds”, i.e., as the various function calls are “popped” off the stack and executed. 7.7 Summary C functions are basic building blocks in every C program. We have given key points those to be kept in mind for using existing C library functions and writing our own functions in a C program efficiently. All C programs contain main() function which is mandatory. main() function is the function from where every C program is started to execute. Name of the function is unique in a C program. C Functions can be invoked from anywhere within a C program. There can any number of functions be created in a program. There is no limit on this. There is no limit in calling C functions in a program. All functions are called in sequence manner specified in main() function. One function can be called within another function. C functions can be called with or without arguments/parameters. These arguments are nothing but inputs to the functions. C functions may or may not return values to calling functions. These values are nothing but output of the functions. When a function completes its task, program control is returned to the function from where it is called. There can be functions within functions. Before calling and defining a function, we have to declare function prototype in order to inform the compiler about the function name, function parameters and return value type. C function can return only one value to the calling function. When return data type of a function is “void”, then, it won’t return any values CU IDOL SELF LEARNING MATERIAL (SLM)
188 Computer Programming When return data type of a function is other than void such as “int, float, double”, it returns value to the calling function. main() program comes to an end when there is no functions or commands to execute. There are 2 types of functions in C. They are, 1. Library functions 2. User defined functions 7.8 Key Words/Abbreviations Function declaration: A function declaration tells the compiler about a function's name, return type, and parameters. A function definition provides the actual body of the function. Function Call: If a function does not return a value (or if we are not interested in the value returned by it), a function call takes the form of a C statement in which the function call is followed by a semicolon as shown below. printf(\"Enter values of a and b: \"); scanf(\"%d %d\", &a, &b); Function Definition: A function definition provides the actual body of the function. 7.9 Learning Activity 1. Explain Recursive function. ....................................................................................................................................... ....................................................................................................................................... 2. What is call by value and call by reference? ....................................................................................................................................... ....................................................................................................................................... 7.10 Unit End Questions (MCQ and Descriptive) A. Descriptive Type: Short Answer Type Questions 1. Define function. What is the use of function? 2. How can you functions? Explain with example. CU IDOL SELF LEARNING MATERIAL (SLM)
Functions 189 3. What are the advantages of function prototype in C? 4. What is the difference between function declaration and function definition? 5. How do you use parameters in C functions? 6. What are the types of functions? 7. How can you access function? Give example. 8. Explain block structure of function with diagram. 9. What are the two different ways to pass arguments? 10. Explain argument data types with its types. 11. What is recursion? Explain with example. 12. How is recursion use in function? Explain in detail. 13. Write a program in C to print factorial of a number using recursion. 14. Write a program in C to print Fibonacci series using recursion. 15. Write a program in C to print reverse of the string using recursion. B. Multiple Choice/Objective Type Questions 1. Which of the following is a correct format for declaration of function? (a) return-type function-name(argument type); (b) return-type function-name(argument type){} (c) return-type (argument type)function-name; (d) all of the mentioned 2. The value obtained in the function is given back to main by using ________ keyword. (a) return (b) static (c) new (d) volatile 3. Which of the following function declaration is illegal? (a) int 1bhk(int); (b) int 1bhk(int a); (c) int 2bhk(int*, int []); (d) all of the mentioned CU IDOL SELF LEARNING MATERIAL (SLM)
190 Computer Programming 4. Which is an indirection operator among the following? (a) & (b) * (c) -> (d) . 5. What will be the output of the following C code? #include <stdio.h> int main() { int i = 10; void *p = &i; printf(\"%d\\n\", (int)*p); return 0; } (a) Compile time error (b) Segmentation fault/runtime crash (c) 10 (d) Undefined behaviour Answers: 1. (a), 2. (a), 3. (d), 4. (b), 5. (a) 7.11 References 1. https://beginnersbook.com/2014/01/c-functions-examples/ 2. https://www.programiz.com/c-programming/c-functions. 3. https://publications.gbdirect.co.uk/c_book/thecbook.pdf 4. https://phy.ntnu.edu.tw/~cchen/ctutor.pdf CU IDOL SELF LEARNING MATERIAL (SLM)
Pointers 191 UNIT 8 POINTERS Structure: 8.0 Learning Objectives 8.1 Introduction 8.2 Fundamentals of Pointer 8.3 Pointer Variables 8.4 Referencing and Dereferencing 8.5 Pointer Arithmetic 8.6 Using Pointers with Arrays 8.7 Using Pointers with Strings 8.8 Arrays of Pointers 8.9 Pointers as Function Arguments 8.10 Functions Returning Pointers 8.11 Summary 8.12 Key Words/Abbreviations 8.13 Learning Activity 8.14 Unit End Questions (MCQ and Descriptive) 8.15 References 8.0 Learning Objectives After studying this unit, you will be able to: Describe the concepts of pointers Elaborate the pointer to pointer concept CU IDOL SELF LEARNING MATERIAL (SLM)
192 Computer Programming Differentiate between pointer to array and array of pointers Describe functions returning a pointer 8.1 Introduction Introduction to C Pointers. A Pointer in C language is a variable which holds the address of another variable of same data type. Pointers are used to access memory and manipulate the address. Pointers are one of the most distinct and exciting features of C language. 8.2 Fundamentals of Pointer Variable values are stored in memory locations and every memory location has an address. This memory address of a variable can be accessed using an ampersand (&) operator. What are pointers? A pointer is a variable that represents the location (rather than the value) of a data item in memory, such as a variable or an array element. Pointer is a very useful tool of C programming as it can help improve the programs efficiency and allow the user to handle unlimited amount of data. Pointers are also closely associated with arrays, and therefore, provide an alternate way to access individual array elements. Variable are stored in the memory in one or more contiguous memory location. This depends on the type of data. For example, a single char is stored in one byte of memory, an integer variable will be stored in two bytes and floating point may require four contiguous memory locations. Let’s consider a variable x, compiler immediately assigns a memory location after the variable declaration. The address of variable x can be accessed using the expression & x, where & is a unary operator called address operator, that evaluates the address of its operand. Now suppose the address of x is assigned to another variable, px, i.e., px = &x; This new variable, px, is called a pointer to x because it points to the location where x is stored in memory. Thus px is referred to as pointer variable. The data item identified by x can also be accessed by the expression *px, where * is a unary operator that operates on only a pointer CU IDOL SELF LEARNING MATERIAL (SLM)
Pointers 193 variable. Therefore, *px and x both identify the same data. The relationship between px and x is shown in the diagram below: Address of x Value of x px x Fig. 8.1: Relationship between Pointer Variable and Variable 8.3 Pointer Variables 8.3.1 Defining and Declaration of a Pointer Variable Pointer variables, like all other variables, must be declared before they may be used in a C program. The interpretation of a pointer declaration differs; however, from the interpretation of other variable declarations. When a pointer variable is declared, the variable name must be preceded by an asterisk (*). This identifies the fact that the variable is a pointer. The data type that appears in the declaration refers to the object of the pointer, i.e., the data item that is stored in the address represented by the pointer, rather than the pointer itself. The syntax for pointer declaration is data-type *pt_var where pt_var is the name of the pointer variable and data-type refers to the data type of the pointer. (Note: remember that an asterisk must precede pt_var) For example, consider the following snippet for pointer declaration int x, y; //integer variable declaration int *ptr_x; //integer pointer declaration The variable ptr_x is declared as pointer variable that can point to a integer quantity. Note that ptr_x represents an address, not a floating-point quantity. 8.3.2 Pointer Initialization and Pointer Assignment A pointer variable can be initialized by assigning it the address of another variable during pointer variable declaration. Remember that the variable whose address is assigned to the pointer variable must have been declared earlier in the program. CU IDOL SELF LEARNING MATERIAL (SLM)
Search
Read the Text Version
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
- 116
- 117
- 118
- 119
- 120
- 121
- 122
- 123
- 124
- 125
- 126
- 127
- 128
- 129
- 130
- 131
- 132
- 133
- 134
- 135
- 136
- 137
- 138
- 139
- 140
- 141
- 142
- 143
- 144
- 145
- 146
- 147
- 148
- 149
- 150
- 151
- 152
- 153
- 154
- 155
- 156
- 157
- 158
- 159
- 160
- 161
- 162
- 163
- 164
- 165
- 166
- 167
- 168
- 169
- 170
- 171
- 172
- 173
- 174
- 175
- 176
- 177
- 178
- 179
- 180
- 181
- 182
- 183
- 184
- 185
- 186
- 187
- 188
- 189
- 190
- 191
- 192
- 193
- 194
- 195
- 196
- 197
- 198
- 199
- 200
- 201
- 202
- 203
- 204
- 205
- 206
- 207
- 208
- 209
- 210
- 211
- 212
- 213
- 214
- 215
- 216
- 217
- 218
- 219
- 220
- 221
- 222
- 223
- 224
- 225
- 226
- 227
- 228
- 229
- 230
- 231
- 232
- 233
- 234
- 235
- 236
- 237
- 238
- 239
- 240
- 241
- 242
- 243
- 244
- 245
- 246
- 247
- 248
- 249
- 250
- 251
- 252
- 253
- 254
- 255
- 256
- 257
- 258
- 259
- 260
- 261
- 262
- 263
- 264
- 265
- 266
- 267
- 268
- 269
- 270
- 271
- 272
- 273
- 274
- 275
- 276
- 277
- 278
- 279
- 280
- 281
- 282
- 283
- 284
- 285
- 286
- 287
- 288
- 289
- 290
- 291
- 292
- 293
- 294
- 295
- 296
- 297
- 298
- 299
- 300
- 301
- 302
- 303
- 304
- 305
- 306
- 307
- 308
- 309
- 310
- 311
- 312
- 313
- 314
- 315
- 316
- 317
- 318
- 319
- 320
- 321
- 322
- 323
- 324
- 325
- 326
- 327
- 328
- 329
- 330
- 331
- 332
- 333
- 334
- 335
- 336
- 337
- 338
- 339
- 340
- 341
- 342
- 343
- 344