Question: (i) Explain the concept of a pointer in C. (ii) A C program contains the following declarations: char str1[]-Kernighan ; char str2[] = Ritchie;

(i) Explain the concept of a pointer in C. (ii) A C program contains the following declarations: char str1[]-"Kernighan " ; char str2[] = "Ritchie"; char *str3; char c = 'z'; Next, the following lines appear in the program. Describe the effect of each line. printf("%s ", str1); str3 = str1; str3 [3] -Ci printf("%s ", str3); str3 = &str2 [3] ; printf("%s ", str3); printf("%s ", str3 + 2); (30%) (c) The function func is defined according to void func (int *a, int *b) int temp; temp = *a; *b = temp ; Describe in detail how this function works, using as example the code x = 12, y = 4; int func (&x, &y)i printf("%d %d", x, y); What is the purpose of the variable temp
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
