473,387 Members | 1,585 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,387 software developers and data experts.

What is the difference between: int a (*daytab)[13] and int a*daytab[13]

thx
Jun 27 '08 #1
5 1996

int (*)[13] Pointer to an array of 13 int's.
int *[13] Array of 13 pointers to int's.
Jun 27 '08 #2

"magicman" <ir*********@gmail.comwrote in message
news:11**********************************@k13g2000 hse.googlegroups.com..

[What is the difference between: int a (*daytab)[13] and int a
*daytab[13]]

As written: nothing, they're both syntax errors.

On the other hand, int (*daytab)[13] is a pointer to an array of 13 ints.

While int *daytab[13] is an array of 13 pointers to ints.

(Thanks to a program cdecl.exe I've just downloaded. Otherwise I wouldn't
have a clue either. And the existence of such a program suggests I'm not
alone!)

--
Bartc
Jun 27 '08 #3
magicman wrote:
What is the difference between: int a (*daytab)[13] and int a
*daytab[13]
thx
In a declaration the first one declares daytab as a pointer to an array
of 13 ints. The second declares daytab as an array of 13 int*.

For the first one

daytab[n]

will be of type int and for the second one

daytab[n]

will be of type int*.

PS. For 0 <= n <= 12 of course.

Jun 27 '08 #4
santosh <sa*********@gmail.comwrites:
magicman wrote:
>What is the difference between: int a (*daytab)[13] and int a
*daytab[13]
thx

In a declaration the first one declares daytab as a pointer to an array
of 13 ints. The second declares daytab as an array of 13 int*.
I guess you are ignoring the "a" in both!
For the first one

daytab[n]

will be of type int
It will be of type "array of 13 int". It will be converted to an int
pointer in most contexts hence, I suspect, the confusion.
and for the second one

daytab[n]

will be of type int*.
Yes, in both cases daytab[n] could be further subscripted or passed to
function that expects and int *.

--
Ben.
Jun 27 '08 #5
Ben Bacarisse wrote:
santosh <sa*********@gmail.comwrites:
>magicman wrote:
>>What is the difference between: int a (*daytab)[13] and int a
*daytab[13]
thx

In a declaration the first one declares daytab as a pointer to an
array of 13 ints. The second declares daytab as an array of 13 int*.

I guess you are ignoring the "a" in both!
Oops! I'm starting to really believe the research indications that the
brain "reads" what it "wants to read", or "completes" sentences from
partially reading them. Thanks once again for the correction.
>For the first one

daytab[n]

will be of type int

It will be of type "array of 13 int". It will be converted to an int
pointer in most contexts hence, I suspect, the confusion.
>and for the second one

daytab[n]

will be of type int*.

Yes, in both cases daytab[n] could be further subscripted or passed to
function that expects and int *.
Jun 27 '08 #6

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

Similar topics

137
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...
0
by: Doug Reese | last post by:
hello, i have what seems to me a very common operation i'm performing. i need to find the balance on an invoice. i was not having any problems until the production server was upgraded to mysql...
9
by: Vipul Jain | last post by:
Can any one please tell me what is the difference between global scope of an variable and file scope of an variable. Vipul
72
by: E. Robert Tisdale | last post by:
What makes a good C/C++ programmer? Would you be surprised if I told you that it has almost nothing to do with your knowledge of C or C++? There isn't much difference in productivity, for...
5
by: Kemal Ozan | last post by:
Hi, I am studying K&R book. On the multidimensional Arrays chapter they say "int (*daytab) is a pointer to an array of 13 integers. The parenthesis are necessary since brackets have higher...
48
by: Wade Yin | last post by:
Hi, What's the difference between: char *x="abcde"; and char y={"abcde"};
7
by: Simon Peng | last post by:
-- ---------------- Simon Peng xqpeng@tsinghua.org.cn
19
by: arnuld | last post by:
this programme runs without any error but it does not do what i want it to do: ------------- PROGRAMME -------------- /* K&R2, section 1.6 Arrays; Exercise 1-13. STATEMENT: Write a program...
18
by: sam | last post by:
(newbie)Technically what's the difference between memset() and memcpy() functions?
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.