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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Sam HobbsRank #107 · 20.5K reputationPosted Oct 17, 2010, 3:13 PM EDT
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);
}
Subhendu DeRank #1,108 · 1.7K reputationPosted Dec 7, 2010, 10:48 PM EST
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