Structured programming


Question 1: Describe the meaning of each of the given pointer declarations:

i) float a = -0.137;
   float *pa = &a;

ii) double *fa(double *a, double *b, double *c);

iii) char *d[4] = {“north”, “south”, “east”, “west”};

iv) int (*pf)(char *a, char *b);

Question 2: Read the structured program shown below and answer the questions:

int i, j = 25;
int *pi, *pj = &j;
*pj = j + 5;
i = *pj + 5;
pi = pj;
*pi = i + j;

Suppose each integer quantity occupies 2 bytes of memory, the hexadecimal address of i begins at F9E and that of j at FA0.

i) What value is symbolized by &i?
ii) What value is symbolized by &j?
iii) What value is assigned to pj?
iv) What value is assigned to *pj?
v) What value is assigned to i?
vi) What value is symbolized by pi?
vii) What final value is assigned to *pi?
viii) What value is symbolized by (pi + 2)?
ix) What value is symbolized by the expression (*pi + 2)?
x) What value is symbolized by the expression *(pi + 2)?

Question 3: Write a suitable declaration for each of the given situations comprising the pointers.

a) Declare a function which accepts an argument which is a pointer to an integer quantity and returns a pointer to a six-element character array.

b) Declare a function which accepts an argument which is a pointer to an integer array and returns a character.

c) Declare a function which accepts an argument which is an array of pointers to integer quantities and returns a character.

d) Declare a function which accepts an argument which is an integer array and returns a pointer to the character.

e) What is the main purpose of the buffer area when working with a stream oriented data file?

f) How is the buffer area defined? Describe your answer with suitable sample code.

g) What is the main purpose of the fclose function? Is it essential within a program by using a data file?

h) Write the sample code to open a data file called 'inputfile.txt' in read only mode and to check whether the file is properly opened. 

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: Structured programming
Reference No:- TGS06280

Expected delivery within 24 Hours