Tuesday, August 3, 2010

C Question Set 2-19


  1. What are data type modifiers?

To extend the data handling power, C adds 4 modifiers which may only be applied to char and int. They are namely signed, unsigned, long and short. Although long may also be applied to double.


 


  1. Interpret the meaning of the following.
    1. “ab”,”a+b”
    2. “w+t”

Answer:


"ab","a+b"->open a binary file for appending


"w+t" ->create a text file for reading and writing.


 


  1. What is NULL in the context of files?

In using files, if any error occurs, a NULL pointer is returned.


 


  1. What is Register storage class?

It concerns itself with storing data in the registers of the microprocessor and not in memory. The value of the variable doesn't have to be loaded freshly from memory every time. It's important to realize that this a request to the compiler and not a directive. The compiler may not be able to do it. Since the registers are normally of 16 bits long, we can use the register storage class for ints and char's.


 


  1. What is an assertion statement?

They are actually macros. They test statements you pass to them and if the statement is false, they halt the program and inform you that the assertion failed. It is defined in the header file <assert.h>.


 


  1. Parse int *(*(*(*abc)())[6])();

abc is a pointer to a function returning a pointer to array of pointer to functions returning pointer to integer.

No comments:

Post a Comment