On Sun, 2007-09-30 at 18:57 +0200, Bernd Petrovitsch wrote: > On Sun, 2007-09-30 at 18:12 +0200, Michael Blizek wrote: > > I'm assuming you're working in userspace, since the memory allocation > > Which leads to the obvious question: What's the relevance of the > question to the Linux kernel? exactly... > > function in the kernel is kmalloc. > > > > On Sat, 2007-09-29 at 16:49 -0700, Irfan Ahmed wrote: > > > I need four dimensional array like > > > double a[256][256][256][256]; > > > > > > > > > but the size is too big to use an array. > > Why? Because that array was on the stack! > > > I was thinking to use *a[256][256][256] > > > Can I use this ...and if yes how I can allocate the memory for > > > this...? > ---- snip ---- > a = malloc(sizeof(double) * 256 * 256 * 256). > ---- snip ---- > But this is only 3-dimensional and (in terms of RAM usage) equivalent to > declaring > ---- snip ---- > double a[256][256][256]; > ---- snip ---- > and using it. > What are you trying to accomplish? I suppose a pointer to an "array" of pointers to a 3 dimensional array. > > You can do this, but it would be a 3 dimensional array of pointers, > > which is probably not what you want. Why not just allocate a memory and > > "cast" the pointer to an array? > > Just assign/use it, no cast necessary. In fact, casting to quiet the > compiler hides probably serious errors and problems. That's why I've put it under quotes. -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ