Explain the functionality of the following lines of code Mak
Solution
e) This program is creating two pointer and allocating memory for pointer q to store a double.
Then it assign a value of 3.14 to location pointed by ointer q.
Then it assign q to p essentially making both of them to point to same location.
Then it change value at location pointed by q which is also pointed by p.
Finally it print values stored at address pointed by pointer p and q which are same.
This program will print value of *p and *q as 6.66.
f)
#include <stdio.h>
int main() {
int arr[5][10];
int n = 5;
int m = 10;
int i = 0,j = 0;
while ( i < n)
{
j = 0;
while (j < m)
{
arr[i][j] = 20; // Storing random value. comment this if uncommenting below lines.
// Please uncomment this part if you want to pick values from command line.
// int value;
// scanf(\"%d\", &value);
// arr[i][j] = value
j++;
}
i++;
}
return 0;
}
