1. What's the difference between the following two C statements? const char *p; char* const p;
2. Write a C function which does the addition of two integers without using the '+' or '-' operator.
3. The following is the macro implementation of the famous, Triple xor swap. #define SWAP(a,b) ((a) ^= (b) ^= (a) ^= (b)) What are the potential problems with the above macro?
1. const char *p means value pointed by p is a constant whereas address stored in p is mutable.
ReplyDeletechar* const p means address stored in p is immutable whereas value pointed by p can be modified.
2. Use same method used to implement full adder circuit using bitwise operator.
3. If any argument is 0.