473,396 Members | 2,034 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How The Address or Value Access from 3D array using pointers?

Expand|Select|Wrap|Line Numbers
  1. main( )
  2. {
  3.   int a[2][3][2] = {{{2,4},{7,8},{3,4}},{{2,2},{2,3},{3,4}}};
  4. printf("%u %u %u %d \n",a,*a,**a,***a);
  5. printf("%u %u %u %d \n",a+1,*a+1,**a+1,***a+1);
  6.       }

If the location of an array start from 100.

can you please explain all this by giving the demonstration of how the location is saved from one to other & how the location & the value is access please explain in detail.
Thank you
Jun 1 '10 #1
3 2630
Banfa
9,065 Expert Mod 8TB
You might want to start by running the code and seeing if you can explain it.

As a tip it may (or may not) help if all the values in the array have different values so you can easily differentiate them.
Jun 1 '10 #2
weaknessforcats
9,208 Expert Mod 8TB
You might also read this article: http://bytes.com/topic/c/insights/77...rrays-revealed.

There is a lot of info here about how arrays actually work.
Jun 1 '10 #3
donbock
2,426 Expert 2GB
You are using %u (unsigned int) to print [some] pointer values. Are you sure int is wide enough on your platform?

I suggest changing your array declaration from int to unsigned long and then using conversion specifier "%lu". Unsigned long isn't guaranteed to be wide enough to hold a pointer value either, but from a practical point of view it is good enough.
Jun 1 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Noah Spitzer-Williams | last post by:
Hello guys, I'm itinerating through my array using pointers in this fashion: image is unsigned char image do { cout << "image byte is: " << *image << endl;
31
by: arun | last post by:
suppose i have a pointer to an array of integers.can i initialize each member of the array using pointers?plz explain
4
by: mVosa | last post by:
I have this piece of code in a funtion which is trying to retrieve the memory address of values that are stored in a 2D array, using pointers...Could I get help or tips on how to do this please...
2
by: Bond | last post by:
i have written this program of entering 2-d array through pointers.this shows number of errors.please help me out. #include<stdio.h> #include<alloc.h> void aread(int*,int*,int*); void...
5
by: EJSpin | last post by:
Hey guys, I have put together a class called Mu class Mu { private: double **s; int velocity,numbers; double sPeak,muPeak,mu1; ...
10
by: bimbam | last post by:
Hi, I've been trying to allocate dynamicaly an array of pointers to structures. As it didn't work, I tried to reduce the problem as much as possible. This is what I have : #include...
1
by: niteshpanchal | last post by:
Hi, I want to assign array of 5 using pointer. How can i ?
1
by: niteshpanchal | last post by:
Hi, How to assign dynamic array using pointers for string.
3
by: Keith Thompson | last post by:
Victor <vhnguyenn@yahoo.comwrites: You're declaring an array of pointers to unsigned long long, but you're initializing the pointers with integer values. This is actually a constraint...
2
by: hanaa | last post by:
Hello I need to call a function that returns a 2D array. I need to dynamically allocate memory for the array in the callee. Now, I return using a pointer to a pointer. In the callee, I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.