Here comes the explanation to your questions:
increment( i ) is a local function and the value of i that is incremented inside the function will not be reflected in the main function and so the loop will never end because the loop variable is not changed.
The condition is tested and then the loop breaks giving you the value as 5 outside the loop.
Static variables are stored in heap and preserve the value for the execution of the program and so it does not reset for each function call where as other variable are allocated in the stack which gets destroyed when the function returns.
can some one please tell me the answer for this Q?
Thanks in advance..
* sys/cdef.h */
#if defined(__STDC__) || defined(__cplusplus)
#define __P(protos) protos
#define __P(protos) ()
/* stdio.h */
div_t div __P((int, int));
The code above comes from header files for the FreeBSD implementation of the C library. What is the primary purpose of the __P() macro?
The __P() macro has no function, and merely obfuscates library function declarations. It should be removed from further releases of the C library.
The __P() macro provides forward compatibility for C++ compilers, which do not recognize Standard C prototypes.
Identifiers that begin with two underscores are reserved for C library implementations. It is impossible to determine the purpose of the macro from the context given.
The __P() macro provides backward compatibility for K&R C compilers, which do not recognize Standard C prototypes.
The __P() macro serves primarily to differentiate library functions from application-specific functions.