Ya. Seriously. We appreciate your help but you aren't a college professor and I don't want to pay like 20 or whatever dollars if I only need a vid here and there.
Use sizeof() operator inside malloc. I.e. for: int array[1000] you can write: malloc(1000*sizeof(int)), thus allocating [(1000*4) = 4000] bytes of memory on heap (whatever heap is lol).
@doubleja Haha thanks :). The heap is free memory that floats around, as opposed to the stack, which is a set of memory that is automatically allocated. We get what's called stack overflow. I hope this helps. Yours helped, so cheers.
Thanks for the tutorial you explained it really well!! I have a question though, how can i allocate memory for a matrix, lets say i recieve an integer N from command line how can i allocate memory of size N*N?
Ya. Seriously. We appreciate your help but you aren't a college professor and I don't want to pay like 20 or whatever dollars if I only need a vid here and there.
foellerd 1 week ago
why dont you just use the sizeof operator?
Deadnature 2 months ago
another bad joke
pangutu 2 months ago
Previous part: youtube.com/watch?v=G4uioaFmU3k
MdnightOne 4 months ago
Comment removed
doubleja 11 months ago
We need the rest of the tutorial?
czarkefa80 1 year ago 2
@czarkefa80
Use sizeof() operator inside malloc. I.e. for: int array[1000] you can write: malloc(1000*sizeof(int)), thus allocating [(1000*4) = 4000] bytes of memory on heap (whatever heap is lol).
doubleja 11 months ago
@doubleja Haha thanks :). The heap is free memory that floats around, as opposed to the stack, which is a set of memory that is automatically allocated. We get what's called stack overflow. I hope this helps. Yours helped, so cheers.
czarkefa80 11 months ago
Thanks for the tutorial you explained it really well!! I have a question though, how can i allocate memory for a matrix, lets say i recieve an integer N from command line how can i allocate memory of size N*N?
ART000747 1 year ago
whr's the rest of the tutorial?
lankythekid 1 year ago 7
Comment removed
wuschtnudl 1 year ago