hi all,

i have a question
1) how can we change the value of a macro during compilation time tell me with an example
2) what is difference between exception and memory leak. how to handle exception in c
3) where are the extern and register variables stored(text,data,BSS,heap,stack)

1) how can we change the value of a macro during compilation time tell me with an example

Undefine the macro and define it again.
E.g.

#undef SOMEONE_ELSE_S_MACRO
#define SOMEONE_ELSE_S_MACRO(p1, p2) myfunction_call()

Note:
1. assumed that SOMEONE_ELSE_S_MACRO is defined in already in your .c file OR one of the #includes OR on compilation command line.
2. I donno of any way you can change this back. This would be needed if and when you want the new macro definition to be effective only for a PART of your code. Once you define to what you want for the rest of the code that's what will happen.

2) what is difference between exception and memory leak. how to handle exception in c

They are completely different things. Check up wikipedia to know what they are. Only relation between them if you force to me make is that while one is writing code for exception handling he/she should be careful to write good code else there will be memory leaks.

3) where are the extern and register variables stored(text,data,BSS,heap,stack)

extern keyword doesn't define/affect the storage location of a variables. It just tells the compiler that don't bother abt name resolution now, linker will take care of it. Commonly though people are used to defining extern variables at global scope, in which case they'll be stored in DS.
Register variables are stored in register. But remember that register keyword is a request to the compiler and not an order. In most cases [new] compilers ignore it and decide for themselves which variables are best placed in registers to optimize performance.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.