473,657 Members | 2,801 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

what is the difference in this pointers decalarition

what is the difference in this pointers decalarition ?

int *ptr[10];

and

int (*ptr)[10];

Feb 27 '06 #1
14 2026
One is an array of pointers while the other is a pointer to an array.
Example:

int *ptr[10];
int var1, var2;
ptr[0] = &var1;
ptr[1] = &var2;

......

int (*ptr)[10];
int multiDimensiona lArray[5][10];

ptr = multiDimensiona lArray;

Feb 27 '06 #2

relient wrote:
One is an array of pointers while the other is a pointer to an array.
Example:

int *ptr[10];
int var1, var2;
ptr[0] = &var1;
ptr[1] = &var2;

.....

int (*ptr)[10];
int multiDimensiona lArray[5][10];

ptr = multiDimensiona lArray;


Thank you relient

so how i can access array (multiDimension alArray) with pointer( ptr ).

Feb 27 '06 #3
The same way you would with the multiDimensiona lArray variable.

ptr[0][1] = 5;
- relient

Feb 27 '06 #4
relient wrote:
The same way you would with the multiDimensiona lArray variable.

ptr[0][1] = 5;


*Please* quote what (and /who/) you're replying to. Many people can't
see previous posts, for various reasons. It's also possible to do it
via Google, if you click Show Options, and then Reply below the message
header. It's only one click more than Reply at the bottom of the
message, and will do everything for you.

--
BR, Vladimir

Some people live life in the fast lane.
You're in oncoming traffic.

Feb 27 '06 #5

Vladimir S. Oka wrote:
relient wrote:
The same way you would with the multiDimensiona lArray variable.

ptr[0][1] = 5;


*Please* quote what (and /who/) you're replying to. Many people can't
see previous posts, for various reasons. It's also possible to do it
via Google, if you click Show Options, and then Reply below the message
header. It's only one click more than Reply at the bottom of the
message, and will do everything for you.

--
BR, Vladimir

Some people live life in the fast lane.
You're in oncoming traffic.


Yes, I forgot. I'm sorry.

- relient

Feb 27 '06 #6
Thank you very much.

relient

int (*ptr)[10]; ---> is a pointer to arrays ?.

Feb 27 '06 #7
int *ptr[10] refers to a ptr is an arrary of 10 pointers to an integer.

whereas int (*ptr)[10] refers to a ptr is a pointer to an array of 10
integers.

Feb 27 '06 #8
int *ptr[10] refers to a ptr is an arrary of 10 pointers to an integer.

whereas int (*ptr)[10] refers to a ptr is a pointer to an array of 10
integers.

Feb 27 '06 #9
code break wrote:
Thank you very much.

relient

int (*ptr)[10]; ---> is a pointer to arrays ?.

Thank you for what? Please follow Vladimir's advice.

--
Ian Collins.
Feb 27 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

137
7058
by: Philippe C. Martin | last post by:
I apologize in advance for launching this post but I might get enlightment somehow (PS: I am _very_ agnostic ;-). - 1) I do not consider my intelligence/education above average - 2) I am very pragmatic - 3) I usually move forward when I get the gut feeling I am correct - 4) Most likely because of 1), I usually do not manage to fully explain 3) when it comes true. - 5) I have developed for many years (>18) in many different environments,...
2
16235
by: CoolPint | last post by:
Can anyone clearly explain the difference between constant reference to pointers and reference to constant pointers? What is const int * & ? Is it a constant reference to a pointer to an integer? Or Is it a reference to a pointer to a constant integer? What is being constant in this case? The pointer or the integer being pointed? How about int * const & ? Is this a reference to a constant pointer to an integer? Or
14
2531
by: bo | last post by:
And why and where one should use one vs. the other? Verbally, it seems like semantics to me--but obviously there is some actual difference that makes references different and or preferable over pointers in some cases... TIA
4
14188
by: rahul8143 | last post by:
hello, I require a single c++ program that will illustrate usage of this,far,near pointers. Can any body please explain me those pointers? regards, rahul.
2
4298
by: duyifan.nju | last post by:
hello, can someone tell me what is the difference between sort() (in stl) & qsort(stdlib.h) thanks in advance.
59
3549
by: Ramkumar R K | last post by:
what is the difference between objects and pointers?
16
10368
by: Abhishek | last post by:
why do I see that in most C programs, pointers in functions are accepted as: int func(int i,(void *)p) where p is a pointer or an address which is passed from the place where it is called. what do you mean by pointing to a void and why is it done? Aso, what happens when we typecast a pointer to another type. say for example int *i=(char *)p; under different situations? I am kind of confused..can anybody clear this confusion by clearly...
669
25859
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Language”, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic paper written on this subject. On the Expressive Power of Programming Languages, by Matthias Felleisen, 1990. http://www.ccs.neu.edu/home/cobbe/pl-seminar-jr/notes/2003-sep-26/expressive-slides.pdf
12
2552
by: Michael Bell | last post by:
I am trying to put my learning effort into the most useful things. What do pointers do that other things can't? Michael Bell --
0
8403
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
8737
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8509
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7345
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6174
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5636
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2735
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1967
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.