Plz tell me whats wrong in following statements..
int y[21]; //array declaration
void printfunction(int *y); //protoype
printfunction(y); //call
what changes are required?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Subhendu DePosted Dec 8, 2010, 3:48 AM
System.Array is the Reference type so when you pass the array and call the function, it will not create another copy of it within the function like value type. It will point to the same location.
Sam Hobbs given you the solution. Follow it.
Thanks
Sam HobbsPosted Oct 17, 2010, 7:13 PM
C# arrays are very different from C arrays.
static void printfunction(int[] y)
{
}
static void Main(string[] args)
{
int[] y = new int[21];
printfunction(y);
}