passing 2d array to function - what am i missing here?

0 Richard Trumbore · October 26, 2014
//  P L E A S E   H  E  L  P  !
// what must I do to call function  getFeedingData and pass it
// array feedingData?


#include <iostream>
#include <iomanip>
#include <string>

using namespace std;

const int ROWS = 3;
const int COLS = 6;

string monkeyNames[ROWS] = { "Larry", "Moe", "Curly" };

// prototypes
void getFeedingData(double[ ][COLS], const int);


int main()
{
    // declare arrays
   double feedingData[ROWS][COLS] = { {9.2,3.6,10.8}, {12.6, 3.2, 4.7} };

   // call functions
  getFeedingData(feedingData[ROWS][COLS], ROWS);


return 0;
}


// define function
void getFeedingData(double array[ROWS][COLS], const int COLS)
{
   cout << "inside function getFeedingData\n";
}

Post a Reply

Replies

Oldest  Newest  Rating
0 Richard Trumbore · November 10, 2014
Thanks very much for your help.  Sorry I am just now responding.  I'm just learning to interact in forums.


Richard
  • 1

C++

107,295 followers
About

Used in many types of software including music players, video games, and many large scale applications.

Links
Moderators
Bucky Roberts Administrator