For each of the following values state the C variable type i

For each of the following values state the C variable type (int, double, etc) that is

required to store the value. (Note: there may be more than one correct answer for

each. It is only necessary to give one answer. If the answer is an array type be sure to

give the full description. For example: array of double) (10 marks)

a. 77.25

b. A social security number

c. A variable to hold 100 names

d. A variable which can hold numbers from 1-100 with 0.5 increments

Solution

a)

Here we are declaring a variable \'a\' which is of type double

double a;

//Assigning the value 77.25 into the double type variable \'a\'

a=77.25;

____________

b)

Here we are creating an character array which holds the social security number.

char ssn[]={\"123-45-6789\"};

____________

c)

here we are creating an array of function pointers whose name is names whcih stores an 100 strings in it

char* names[100];

like, names[0]=\"Williams\"; names[0]=\"Williams\";

________________

d) float nos[399]

here we are creating an float type array whose name is \'nos\' and size is 399 which can store the values between 1 to 200 with an increment of 0.5

__________________

For each of the following values state the C variable type (int, double, etc) that is required to store the value. (Note: there may be more than one correct ans

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site