Hi!
I want to pass a pointer-to-an-array through a function and print the data in the array. I dont know why its giving junks...! Please tell me where i am wrong and how to achieve this? Please note that i want to do this only through function as shown in the code. Pls. help.

Here is the code:
Code:
 
char *NameList[] = { "Father", "Mother"};
main()
{
  int i;
  Function(NameList);  //Pointer To The Array Is Passed Through The Function
}
 
Function(char *ArrayPointer)
  {
    int i;
    for (i=0; i < 2; i++)
      {
        printf("\nName: %s %s", ArrayPointer[i]);  // Why It is not fetching the data?
      }
  }

Last edited by shabbir; 1Jan2009 at 20:52.. Reason: Code Block