char a[] or any array refers to a block of memory (not a single memory location or variable). Analogy to this can be seen in the following fact :- The memory addresses of an array can't be changed, whereas the content of the pointer variables, such as the base memory address of the array it refers to or simply any variable can be changed.
Hence an undefined result persists..if we really want to return an array from a function we use the following syntax.. *char a[] = "Hello"; char *b = (char *)malloc(strlen(a)+1); strcpy(b,a); return b;* here we are returning the base address of the character array, unlike as wat you were doing previously(previously you were trying to return a block of memory) Hope it is clear now... :) -- *Piyush Sinha* *IIIT, Allahabad* *+91-7483122727* * <https://www.facebook.com/profile.php?id=100000655377926> "NEVER SAY NEVER" * -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.