C++ Passing pointer to function -


ok have function

    int main {    ....    char *wordl=word();//wordl pointer array of characters    ...    gamewindow(wordl,length); }   void gamewindow(char &wordl,int length); 

my question how pass pointer such passed pointer points same array list.. , can access wordl[i] in gamewindow function.

from comment below, implementation of word():

   char* word()      { int j=1988497762; cout<<j<<endl ;      static char original[25];      int x;      ifstream fin("out.txt");      (j=0;!fin.eof();j++)      fin.getline(original,25);      fin.close();      srand ( (unsigned) time(null) );      x = rand()%j; cout<<x<<"\n";      cout<<rand()<<endl;      char c;      ifstream finn("out.txt");      (j=0; !finn.eof(); j++)      { finn>>c; finn.getline(original,25); if (x==j) break; }      finn.close();      return original; } 

if want use (and not use std::vector or std::string) need change gamewindow void gamewindow(char *wordl,int length); can access char using word1[i].


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -