C Programming Interview Questions
General Questions I
C Program - General Questions
- Is const volatile possible ?
- Where a const volatile variable is used?
- Write a macro to swap the nibbles in the word ?
Ex:0x5678 output:6587
- Diff types of storage classes and details of each storage class
- Detailed discussion on Static like storage, default, scope, life time.
- which pointer value we can modify.
- Explane
const volatile int *ptr;
*const volatile int ptr;
- What is the difference between inline and macro?
- Write program to reset bit in register if address of register is given reset (int address, int bit)
- How to know size of memory allocated by malloc using pointer?
- How do you implement malloc ?
- Explain cinit and bss section
- Declare an array of 10 integer pointers
- Volatile variable in-depth (definition, use case, impact, when to avoid, etc)
- Where does dynamic memory allocation get stored?
- Write a program to implement memcopy.
- Optimize it such that it uses NO stack space at all
- What are the pros and cons of using dynamic memory allocation versus static memory allocation?
- If you had to allocate 1MB of memory that needs to be used for only a short time, which type of allocation would you use?
- structure padding
- about #pragma
- What are bit field ?
- How to avoid re declaration of header files
- Bit operations
- C program for factorial, prime number with recursion
- What memcopy do? implement your own memcopy function?with optimization(less usage of variables?)
- Where do const variables get stored? (literal segment)
- Static, auto, etc
- Why does the compiler perform padding?
- toggle alternate bits
- memcpy implementation
- Find a word from string
- How to find if their is in repeating node in linked list
- For a given array gather all 1's to one side and 0's to one side.
- In a given byte interchage pair of bits
- Reverse linked list
- Reverse string
- Reverse a word in a string
- Declare a array of function pointer of taking two arguments
- How to find little endian and big endian
- About dynamic and static memory
- about function pointers
- Advantages of func pointers
- Advantages of call back functions.
- What Null pointer
- In a big array consists of 1's & 0's ,write an efficient programe to keep all 1's to right side and 0's to other side?
- how can you determine whether your memory is in protected or un-protected mode