Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Voxera118477yInt** is that not a pointer to an array of pointers?
X[n][n] is an address in a continuous memory but a pointer to a pointer is not the same thing.
See this post (my c skills is a bit dated but I do think they are different in how they address things.
https://stackoverflow.com/questions... -
Crazed20587y@Voxera im honestly not sure, we barely started learning about pointers in class. This is a continuation of an assignment that the vast majority of my class failed.
-
Voxera118477y@Crazed look it up or do some isolated testing. Its been almost 18 years since I did any serious C programming.
-
Crazed20587y@projektaquarius he's an older indian man with broken english. We're reading a .dat file and creating a .ppm file with a greedy algorithm using procedural paradigm to do it all. The first aasignment was using a 1D array and just passing it around, now we're doing it with a 2D array and multiple paths... The class average for the last assignment was 35%, and that's with "if it compiles and runs mostly correctly its full credit"
-
Voxera118477yA list of pointers does not have to address continuous memory since each pointer is allocated separately but an straight multi dimensional array is a continuous chunk of memory.
How do you initialize the memory? -
Crazed20587y@Voxera initialized the array by goint through every time I create an inner array of type int[width] and setting all of those values to 0
-
Crazed20587y@Voxera @projektaquarius I was able to get it running when putting my code from the function into main. Its not procedural, but this is due tomorrow and I have other classes I need to work with. Ill take a 90 over a 0 any day.
-
Crazed20587y@Voxera I have absolutely no idea. I barely had and c++ exposure coming into this class. This is my first time working with pointers. I can access and modify my **array element via array[i][j] inside of main, attempting to pass it though I have no idea what or how to access it.
-
Crazed20587y@runfrodorun I can not give you enough ++. I have been googling for hours. Legitimate MVP over here.
-
@runfrodorun yeah I realized my mistake and pulled the comment. Did not want to spread misinformation.
-
Crazed20587y@runfrodorun thanks for the tip! Unfortunately im limited as thr notation was required by the instructions :(
-
Voxera118477y@runfrodorun Yes,
That was the first basic version I came in contact with on PC.
Running on MS dos 2.11d ;) from 360kbyte floppy disks.
Related Rants
C++ gods, help me!
I'm passing a variable of type int** (an array of type int*[], whoss values arr of type (int *) new int[])
The function definition takes int ***arrayName and I am setting the values with *arrayName[i][j]. This works for all i=0, but when i>=1, I get a segfault!
I really dont know why or what this means, any ideas? :(
joke/meme
help
c++
urgent