1.Explain about C language

Ans:C language is a structure/procedure oriented, middle level programming language developed at Bell Laboratories in 1972 by Dennis Ritchie. C language was invented for implementing UNIX operating system. In 1978, Dennis Ritchie and Brian Kernighan published the first edition “The C Programming Language”. Also, C language is an ANSI/ISO standard and powerful programming language for developing real time applications.

2.What are dangling pointers? How are dangling pointers different from memory leaks?

Ans:Dangling pointers arise during object destruction, when an object that has an incoming reference is deleted or deallocated, without modifying the value of the pointer, so that the pointer still points to the memory location of the deallocated memory.

3.What is the difference between abs( ) and fabs( ) functions?

Ans:abs() and fabs () functions, both are used to retrieve or calculate the absolute value. The only difference between both of them is, abs() is used to calculate the absolute value for integer type numbers whereas fabs() are used for floating type numbers. abs() function is use under the library file and fabs() function is use under the library file .

4.How to free a block of memory previously allocated without using free?

If the pointer holding that memory address is passed to realloc with size argument as zero (like realloc(ptr, 0)) the the memory will be released.

5. What is the difference between const char* p and char const* p?

In const char* p, the character pointed by pointer variable p is constant. This value can not be changed but we can initialize p with other memory location. It means the character pointed by p is constant but not p. In char const* p, the pointer p is constant not the character referenced by it. So we can't assign p with other location but we can change the value of the character pointed by p.

6. What is the difference between "calloc(...)" and "malloc(...)"?

1. calloc(...) allocates a block of memory for an array of elements of a certain size. By default the block is initialized to 0. The total number of memory allocated will be (number_of_elements * size). malloc(...) takes in only a single argument which is the memory required in bytes. malloc(...) allocated bytes of memory and not blocks of memory like calloc(...). 2. malloc(...) allocates memory blocks and returns a void pointer to the allocated space, or NULL if there is insufficient memory available. calloc(...) allocates an array in memory with elements initialized to 0 and returns a pointer to the allocated space. calloc(...) calls malloc(...) in order to use the C++ set_new_mode function to set the new handler mode.

7. What are the datatypes accepted in the bit fields ?

Int,short, signed short, unsigned short char, signed char, unsigned char long, signed long, unsigned long longlong, signed long long, unsigned long long

8.Explain The Term Enumerations In C?

A set of named integer constants is known as an enumeration. The enumeration type declaration includes the name of the enumeration tag and the definition of a set of named integers.  Ex: enum CITY { Mumbai, Bangalore, Chennai, NewDelhi } metros ;