C examples for Function:Function Return
The variable returned should not be a local variable since the memory to these variables is released when the function ends.
#include <stdio.h> int* byAdr(int* i) { (*i)++; return i; } int main(void) { int a = 10;// www . java 2s .com int *p = byAdr(&a); printf("%d", *p); /* "11" */ }