Wed May 1 18:11:24 2024
EVENTS
 FREE
SOFTWARE
INSTITUTE

POLITICS
JOBS
MEMBERS'
CORNER

MAILING
LIST

NYLXS Mailing Lists and Archives
NYLXS Members have a lot to say and share but we don't keep many secrets. Join the Hangout Mailing List and say your peice.

DATE 2008-08-01

HANGOUT

2024-05-01 | 2024-04-01 | 2024-03-01 | 2024-02-01 | 2024-01-01 | 2023-12-01 | 2023-11-01 | 2023-10-01 | 2023-09-01 | 2023-08-01 | 2023-07-01 | 2023-06-01 | 2023-05-01 | 2023-04-01 | 2023-03-01 | 2023-02-01 | 2023-01-01 | 2022-12-01 | 2022-11-01 | 2022-10-01 | 2022-09-01 | 2022-08-01 | 2022-07-01 | 2022-06-01 | 2022-05-01 | 2022-04-01 | 2022-03-01 | 2022-02-01 | 2022-01-01 | 2021-12-01 | 2021-11-01 | 2021-10-01 | 2021-09-01 | 2021-08-01 | 2021-07-01 | 2021-06-01 | 2021-05-01 | 2021-04-01 | 2021-03-01 | 2021-02-01 | 2021-01-01 | 2020-12-01 | 2020-11-01 | 2020-10-01 | 2020-09-01 | 2020-08-01 | 2020-07-01 | 2020-06-01 | 2020-05-01 | 2020-04-01 | 2020-03-01 | 2020-02-01 | 2020-01-01 | 2019-12-01 | 2019-11-01 | 2019-10-01 | 2019-09-01 | 2019-08-01 | 2019-07-01 | 2019-06-01 | 2019-05-01 | 2019-04-01 | 2019-03-01 | 2019-02-01 | 2019-01-01 | 2018-12-01 | 2018-11-01 | 2018-10-01 | 2018-09-01 | 2018-08-01 | 2018-07-01 | 2018-06-01 | 2018-05-01 | 2018-04-01 | 2018-03-01 | 2018-02-01 | 2018-01-01 | 2017-12-01 | 2017-11-01 | 2017-10-01 | 2017-09-01 | 2017-08-01 | 2017-07-01 | 2017-06-01 | 2017-05-01 | 2017-04-01 | 2017-03-01 | 2017-02-01 | 2017-01-01 | 2016-12-01 | 2016-11-01 | 2016-10-01 | 2016-09-01 | 2016-08-01 | 2016-07-01 | 2016-06-01 | 2016-05-01 | 2016-04-01 | 2016-03-01 | 2016-02-01 | 2016-01-01 | 2015-12-01 | 2015-11-01 | 2015-10-01 | 2015-09-01 | 2015-08-01 | 2015-07-01 | 2015-06-01 | 2015-05-01 | 2015-04-01 | 2015-03-01 | 2015-02-01 | 2015-01-01 | 2014-12-01 | 2014-11-01 | 2014-10-01 | 2014-09-01 | 2014-08-01 | 2014-07-01 | 2014-06-01 | 2014-05-01 | 2014-04-01 | 2014-03-01 | 2014-02-01 | 2014-01-01 | 2013-12-01 | 2013-11-01 | 2013-10-01 | 2013-09-01 | 2013-08-01 | 2013-07-01 | 2013-06-01 | 2013-05-01 | 2013-04-01 | 2013-03-01 | 2013-02-01 | 2013-01-01 | 2012-12-01 | 2012-11-01 | 2012-10-01 | 2012-09-01 | 2012-08-01 | 2012-07-01 | 2012-06-01 | 2012-05-01 | 2012-04-01 | 2012-03-01 | 2012-02-01 | 2012-01-01 | 2011-12-01 | 2011-11-01 | 2011-10-01 | 2011-09-01 | 2011-08-01 | 2011-07-01 | 2011-06-01 | 2011-05-01 | 2011-04-01 | 2011-03-01 | 2011-02-01 | 2011-01-01 | 2010-12-01 | 2010-11-01 | 2010-10-01 | 2010-09-01 | 2010-08-01 | 2010-07-01 | 2010-06-01 | 2010-05-01 | 2010-04-01 | 2010-03-01 | 2010-02-01 | 2010-01-01 | 2009-12-01 | 2009-11-01 | 2009-10-01 | 2009-09-01 | 2009-08-01 | 2009-07-01 | 2009-06-01 | 2009-05-01 | 2009-04-01 | 2009-03-01 | 2009-02-01 | 2009-01-01 | 2008-12-01 | 2008-11-01 | 2008-10-01 | 2008-09-01 | 2008-08-01 | 2008-07-01 | 2008-06-01 | 2008-05-01 | 2008-04-01 | 2008-03-01 | 2008-02-01 | 2008-01-01 | 2007-12-01 | 2007-11-01 | 2007-10-01 | 2007-09-01 | 2007-08-01 | 2007-07-01 | 2007-06-01 | 2007-05-01 | 2007-04-01 | 2007-03-01 | 2007-02-01 | 2007-01-01 | 2006-12-01 | 2006-11-01 | 2006-10-01 | 2006-09-01 | 2006-08-01 | 2006-07-01 | 2006-06-01 | 2006-05-01 | 2006-04-01 | 2006-03-01 | 2006-02-01 | 2006-01-01 | 2005-12-01 | 2005-11-01 | 2005-10-01 | 2005-09-01 | 2005-08-01 | 2005-07-01 | 2005-06-01 | 2005-05-01 | 2005-04-01 | 2005-03-01 | 2005-02-01 | 2005-01-01 | 2004-12-01 | 2004-11-01 | 2004-10-01 | 2004-09-01 | 2004-08-01 | 2004-07-01 | 2004-06-01 | 2004-05-01 | 2004-04-01 | 2004-03-01 | 2004-02-01 | 2004-01-01 | 2003-12-01 | 2003-11-01 | 2003-10-01 | 2003-09-01 | 2003-08-01 | 2003-07-01 | 2003-06-01 | 2003-05-01 | 2003-04-01 | 2003-03-01 | 2003-02-01 | 2003-01-01 | 2002-12-01 | 2002-11-01 | 2002-10-01 | 2002-09-01 | 2002-08-01 | 2002-07-01 | 2002-06-01 | 2002-05-01 | 2002-04-01 | 2002-03-01 | 2002-02-01 | 2002-01-01 | 2001-12-01 | 2001-11-01 | 2001-10-01 | 2001-09-01 | 2001-08-01 | 2001-07-01 | 2001-06-01 | 2001-05-01 | 2001-04-01 | 2001-03-01 | 2001-02-01 | 2001-01-01 | 2000-12-01 | 2000-11-01 | 2000-10-01 | 2000-09-01 | 2000-08-01 | 2000-07-01 | 2000-06-01 | 2000-05-01 | 2000-04-01 | 2000-03-01 | 2000-02-01 | 2000-01-01

Key: Value:

Key: Value:

MESSAGE
DATE 2008-08-30
FROM Ruben Safir
SUBJECT Subject: [NYLXS - HANGOUT] Re: multi-dim arrays in c
On Fri, Aug 29, 2008 at 08:16:35PM -0400, Ruben Safir wrote:
> On Fri, Aug 29, 2008 at 05:43:40PM -0400, Stephen Adler wrote:
> > Guys,
> >
> > I've got a standard c coding question which has been nagging me for a
> > while and I was wondering what you guys may think or have the correct
> > solution to this problem....
> >
> > Lets say I have a 2 dim array of data and the dimension sizes can change
> > depending on the specific data set. I can read in the x and y dimensions
> > from a file, then read in the x*y elements of the data a populate a
> > memory area x*y*elementsizeinbytes with the data. But now I want to
> > access the data. Without doing pointer arithmatic, is it possible to use
> > the standard [][] notation somehow?
> >
> > for example
> >
> > int *data;
> > x=getXDim();
> > y=getYDim();
> > data=(int *)malloc(x*y*sizeof(int));
> > readInData(x,y,data);
> > printf("Middle data element is %d\n",data[y][x]);
> >
> > but I know that that data[y][x] will barf on the compiler because the
> > compiler has no way of knowing what the y size of the "y" dimension is...
> >
> > Any suggestions on how to use the N-dimensional bracket notation in this
> > situation?
> >
> > Thanks.
> >
>
nclude
#include

int **my;
int x = 100;
int y = 500;
int i = 0;
int j = 0;
int k = 0;
int main(){
my = (int **)malloc(x * sizeof(int*));

for(; i my[i] = (int *)malloc(y * sizeof(int *));
}

for(i = 0; i < x; i++)
for(j=0; j my[i][j] = i + j;
printf ("i=> %d j=> %d slot: %d ==> %d\n",i,j,k,my[i][j]);
k++;
printf("Hello\n");
}

printf("%d", my[0][5]);

return 0;

}




>
> Yes, in fact int main() does this using char** as a parameter.
>
> I have a sample worked out on my laptop which I can't put on my
> jobs network, but when I get home I'll post an example.
>
> Ruben
>
>
> >
> > --
> > This message has been scanned for viruses and
> > dangerous content by MailScanner, and is
> > believed to be clean.
> >
> > _______________________________________________
> > Discuss mailing list
> > Discuss-at-blu.org
> > http://lists.blu.org/mailman/listinfo/discuss
>
> --
> http://www.mrbrklyn.com - Interesting Stuff
> http://www.nylxs.com - Leadership Development in Free Software
>
> So many immigrant groups have swept through our town that Brooklyn, like Atlantis, reaches mythological proportions in the mind of the world - RI Safir 1998
>
> http://fairuse.nylxs.com DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002
>
> "Yeah - I write Free Software...so SUE ME"
>
> "The tremendous problem we face is that we are becoming sharecroppers to our own cultural heritage -- we need the ability to participate in our own society."
>
> "> I'm an engineer. I choose the best tool for the job, politics be damned.<
> You must be a stupid engineer then, because politcs and technology have been attached at the hip since the 1st dynasty in Ancient Egypt. I guess you missed that one."
>
> © Copyright for the Digital Millennium
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
> _______________________________________________
> Discuss mailing list
> Discuss-at-blu.org
> http://lists.blu.org/mailman/listinfo/discuss

--
http://www.mrbrklyn.com - Interesting Stuff
http://www.nylxs.com - Leadership Development in Free Software

So many immigrant groups have swept through our town that Brooklyn, like Atlantis, reaches mythological proportions in the mind of the world - RI Safir 1998

http://fairuse.nylxs.com DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002

"Yeah - I write Free Software...so SUE ME"

"The tremendous problem we face is that we are becoming sharecroppers to our own cultural heritage -- we need the ability to participate in our own society."

"> I'm an engineer. I choose the best tool for the job, politics be damned.<
You must be a stupid engineer then, because politcs and technology have been attached at the hip since the 1st dynasty in Ancient Egypt. I guess you missed that one."

© Copyright for the Digital Millennium

  1. 2008-08-01 Mark Simko <msimko-at-optonline.net> Re: [NYLXS - HANGOUT] Time to trash the eeepc
  2. 2008-08-01 Ruben Safir <ruben-at-mrbrklyn.com> Re: [NYLXS - HANGOUT] Time to trash the eeepc
  3. 2008-08-01 Ruben Safir <ruben-at-mrbrklyn.com> Re: [NYLXS - HANGOUT] Time to trash the eeepc
  4. 2008-08-01 Mark Simko <msimko-at-optonline.net> Re: [NYLXS - HANGOUT] Time to trash the eeepc
  5. 2008-08-01 Ruben Safir <ruben-at-mrbrklyn.com> Re: [NYLXS - HANGOUT] Time to trash the eeepc
  6. 2008-08-01 Matthew <mph-at-dorsai.org> Re: [NYLXS - HANGOUT] Time to trash the eeepc
  7. 2008-08-01 Ruben Safir <ruben-at-mrbrklyn.com> Re: [NYLXS - HANGOUT] Time to trash the eeepc
  8. 2008-08-01 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] New Movie Event for NYLXS
  9. 2008-08-01 From: "Michael L. Richardson" <mlr52-at-michaellrichardson.com> Re: [NYLXS - HANGOUT] New Movie Event for NYLXS
  10. 2008-08-01 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] C++ Workshop 2.34
  11. 2008-08-01 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] [afife-at-untangle.com: [vox] Installfest for Schools (Next Week)]
  12. 2008-08-01 Ruben Safir <ruben-at-mrbrklyn.com> Re: [NYLXS - HANGOUT] New Movie Event for NYLXS
  13. 2008-08-03 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] Next NYLXS Meeting
  14. 2008-08-03 From: <mlr52-at-michaellrichardson.com> Re: [NYLXS - HANGOUT] Next NYLXS Meeting
  15. 2008-08-04 Ruben Safir <ruben-at-mrbrklyn.com> Re: [NYLXS - HANGOUT] Time to trash the eeepc
  16. 2008-08-07 From: "Michael L. Richardson" <mlr52-at-michaellrichardson.com> Subject: [NYLXS - HANGOUT] Judge mulls frivolousness of God lawsuit
  17. 2008-08-08 From: <mlr52-at-michaellrichardson.com> Subject: [NYLXS - HANGOUT] Fair use copyrite question
  18. 2008-08-08 Ruben Safir <ruben-at-mrbrklyn.com> Re: [NYLXS - HANGOUT] Fair use copyrite question
  19. 2008-08-08 From: <mlr52-at-michaellrichardson.com> Re: [NYLXS - HANGOUT] Fair use copyrite question
  20. 2008-08-08 Elfen Magix <elfen_magix-at-yahoo.com> Re: [NYLXS - HANGOUT] Fair use copyrite question
  21. 2008-08-08 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] stings lib in C++ and array size
  22. 2008-08-08 From: <mlr52-at-michaellrichardson.com> Re: [NYLXS - HANGOUT] Fair use copyrite question
  23. 2008-08-08 Ruben Safir <ruben-at-mrbrklyn.com> Re: [NYLXS - HANGOUT] Fair use copyrite question
  24. 2008-08-08 From: <mlr52-at-michaellrichardson.com> Re: [NYLXS - HANGOUT] Fair use copyrite question
  25. 2008-08-10 Elfen Magix <elfen_magix-at-yahoo.com> Subject: [NYLXS - HANGOUT] Killing a Posted Refresh
  26. 2008-08-10 Ruben Safir <ruben-at-mrbrklyn.com> Re: [NYLXS - HANGOUT] Killing a Posted Refresh
  27. 2008-08-10 Ruben Safir <ruben-at-mrbrklyn.com> Re: [NYLXS - HANGOUT] Killing a Posted Refresh
  28. 2008-08-11 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] Free Software Chamber of Commerce: Healthcare Focus
  29. 2008-08-12 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] [ruben-at-mrbrklyn.com: Re: (Linux ETC: R Safir) [hardhats](offlist) Re: Free Software Chamber of Commerce: Healthcare Focus]
  30. 2008-08-12 From: "Ronny Abraham" <ronny.coder-at-gmail.com> Re: [NYLXS - HANGOUT] Free Software Chamber of Commerce: Healthcare Focus
  31. 2008-08-12 Mark Simko <msimko-at-optonline.net> Re: [NYLXS - HANGOUT] Free Software Chamber of Commerce: Healthcare
  32. 2008-08-12 Mark Simko <msimko-at-optonline.net> Re: [NYLXS - HANGOUT] Judge mulls frivolousness of God lawsuit
  33. 2008-08-12 From: "Michael L. Richardson" <mlr52-at-michaellrichardson.com> Re: [NYLXS - HANGOUT] Judge mulls frivolousness of God lawsuit
  34. 2008-08-13 Elfen Magix <elfen_magix-at-yahoo.com> Subject: [NYLXS - HANGOUT] Desperately Seeking...
  35. 2008-08-13 From: <mlr52-at-michaellrichardson.com> Re: [NYLXS - HANGOUT] Desperately Seeking...
  36. 2008-08-13 Elfen Magix <elfen_magix-at-yahoo.com> Re: [NYLXS - HANGOUT] Desperately Seeking...
  37. 2008-08-13 From: <mlr52-at-michaellrichardson.com> Re: [NYLXS - HANGOUT] Desperately Seeking...
  38. 2008-08-13 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] [rick-at-linuxmafia.com: [conspire] (forw) Strong Court Ruling Upholds the Artistic License (fwd)]
  39. 2008-08-14 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] Google and Georgia
  40. 2008-08-14 prmarino1-at-gmail.com Re: [NYLXS - HANGOUT] Google and Georgia
  41. 2008-08-14 prmarino1-at-gmail.com Re: [NYLXS - HANGOUT] Google and Georgia
  42. 2008-08-14 Matthew <mph-at-dorsai.org> Re: [NYLXS - HANGOUT] Google and Georgia
  43. 2008-08-15 Ruben Safir <ruben-at-mrbrklyn.com> Re: [NYLXS - HANGOUT] Google and Georgia
  44. 2008-08-17 From: "Paul Charles Leddy" <pcleddy-at-gmail.com> Re: [NYLXS - HANGOUT] [Volunteer4-at-JohnMcCain.com: McCain Campaign Internships]
  45. 2008-08-19 From: "armando fonseca" <afonsec2-at-gmail.com> Re: [NYLXS - HANGOUT] [Volunteer4-at-JohnMcCain.com: McCain Campaign Internships]
  46. 2008-08-19 From: <tameek-at-gmail.com> RE: [NYLXS - HANGOUT] [Volunteer4-at-JohnMcCain.com: McCain Campaign
  47. 2008-08-23 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] Pulse Pen and Linux
  48. 2008-08-23 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] Error in your C++ page on const
  49. 2008-08-24 swd <sderrick-at-optonline.net> Subject: [NYLXS - HANGOUT] SONY VIAO Laptop & openSUSE 11.00 Monitor configuration. Help please.
  50. 2008-08-24 Ruben Safir <ruben-at-mrbrklyn.com> Re: [NYLXS - HANGOUT] SONY VIAO Laptop & openSUSE 11.00 Monitor configuration. Help please.
  51. 2008-08-25 swd <sderrick-at-optonline.net> Subject: [NYLXS - HANGOUT] Re: SONY VIAO Laptop & openSUSE 11.00 Monitor configuration. Help
  52. 2008-08-25 Ruben Safir <ruben-at-mrbrklyn.com> Re: [NYLXS - HANGOUT] Re: SONY VIAO Laptop & openSUSE 11.00 Monitor configuration. Help please.
  53. 2008-08-25 Ruben Safir <ruben-at-mrbrklyn.com> Re: [NYLXS - HANGOUT] C++ Workshop 2.34
  54. 2008-08-26 Elfen Magix <elfen_magix-at-yahoo.com> Subject: [NYLXS - HANGOUT] Suse & FTP
  55. 2008-08-27 Ruben Safir <ruben-at-mrbrklyn.com> Re: [NYLXS - HANGOUT] Suse & FTP
  56. 2008-08-27 Matthew <mph-at-dorsai.org> Re: [NYLXS - HANGOUT] Suse & FTP
  57. 2008-08-27 Mark Simko <msimko-at-optonline.net> Re: [NYLXS - HANGOUT] Suse & FTP
  58. 2008-08-27 Ruben Safir <ruben-at-mrbrklyn.com> Re: [NYLXS - HANGOUT] Suse & FTP
  59. 2008-08-27 swd <sderrick-at-optonline.net> Re: [NYLXS - HANGOUT] Re: SONY VIAO Laptop & openSUSE 11.00 Monitor
  60. 2008-08-27 Ruben Safir <ruben-at-mrbrklyn.com> Re: [NYLXS - HANGOUT] Re: SONY VIAO Laptop & openSUSE 11.00 Monitor configuration. Help please.
  61. 2008-08-27 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] mac book?
  62. 2008-08-27 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] Mac Book
  63. 2008-08-27 From: "armando fonseca" <afonsec2-at-gmail.com> Re: [NYLXS - HANGOUT] Re: SONY VIAO Laptop & openSUSE 11.00 Monitor configuration. Help please.
  64. 2008-08-27 Mark Simko <msimko-at-optonline.net> Re: [NYLXS - HANGOUT] Re: SONY VIAO Laptop & openSUSE 11.00 Monitor
  65. 2008-08-28 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] Free Software Chamber of Commerce:
  66. 2008-08-28 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] August Plans
  67. 2008-08-29 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] [nbs-at-sonic.net: [vox] Volunteers at Software Freedom Day - discs, too]
  68. 2008-08-29 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] Re: multi-dim arrays in c
  69. 2008-08-30 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] Workshop C++ errors
  70. 2008-08-30 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] Re: multi-dim arrays in c

NYLXS are Do'ers and the first step of Doing is Joining! Join NYLXS and make a difference in your community today!