Home
Forum
Register
Blogs
FAQ
Blogs
Recent Entries
Best Entries
Best Blogs
Blog List
Armenian Knowledge Base
>
Technical sections
>
Languages, Compilers, Interpreters
>
C/C++
C/C++ prioroty question
User Name
Remember Me?
Password
Go to Page...
Thread Tools
C/C++ prioroty question
11.08.2004, 10:01
#
1
Hrach_Techie
★★★★★★★★★★★★★
Join Date: 08 2004
Location: London, UK
Age: 45
Posts: 16,531
Rep Power:
7
C/C++ prioroty question
Am confused..
int m[2] = { 1, 5 };
cout << ++*m; //this gives 2
my question is, why is the dereference operator evaluated before ++ inspite of the fact that ++ has a higher precedence than *?
ANy pointers there?
Hrach_Techie
View Public Profile
Find More Posts by Hrach_Techie
11.08.2004, 10:25
#
2
Speedy Gonzales
Ребе - коп!
Join Date: 03 2003
Location: sfba
Age: 47
Posts: 4,189
Rep Power:
5
Операторы ++ и * имеют одинаковый приоритет и порядок выполнения справа налево. Скобки тебе не помогут?
Speedy Gonzales
View Public Profile
Find More Posts by Speedy Gonzales
11.08.2004, 10:47
#
3
ArsenD
Уже давно не младенец
Join Date: 09 2002
Location: Yerevan, Armenia
Posts: 83
Rep Power:
0
Everything seems to be fine... I don't see any problem here.
To be simple... in case of prefix unary operators, the operators are executed in the right-to-left order...
ArsenD
View Public Profile
Find More Posts by ArsenD
11.08.2004, 11:03
#
4
Agregat
Грустно...
Join Date: 08 2002
Location: Там, где всегда идут дожди
Age: 42
Posts: 21,717
Rep Power:
9
operator ++(void) has to be applied to something. Something is dereferenced m.
Agregat
View Public Profile
Visit Agregat's homepage!
Find More Posts by Agregat
11.08.2004, 12:49
#
5
Hans Andersen
the mochinger
Join Date: 02 2002
Location: Paranoid Android, @10:50
Age: 44
Posts: 1,894
Rep Power:
5
just curious, what were you expecting?
Hans Andersen
View Public Profile
Visit Hans Andersen's homepage!
Find More Posts by Hans Andersen
11.08.2004, 13:15
#
6
Speedy Gonzales
Ребе - коп!
Join Date: 03 2003
Location: sfba
Age: 47
Posts: 4,189
Rep Power:
5
guess he expects 5
Speedy Gonzales
View Public Profile
Find More Posts by Speedy Gonzales
11.08.2004, 13:39
#
7
Hans Andersen
the mochinger
Join Date: 02 2002
Location: Paranoid Android, @10:50
Age: 44
Posts: 1,894
Rep Power:
5
but how can one ++arrays?
Hans Andersen
View Public Profile
Visit Hans Andersen's homepage!
Find More Posts by Hans Andersen
11.08.2004, 19:09
#
8
Agregat
Грустно...
Join Date: 08 2002
Location: Там, где всегда идут дожди
Age: 42
Posts: 21,717
Rep Power:
9
никак на самом деле.
Agregat
View Public Profile
Visit Agregat's homepage!
Find More Posts by Agregat
վոշմի վեռնագիր
12.08.2004, 10:55
#
9
hrayr
Պապայություն !
Join Date: 08 2004
Location: Yerevan, Armenia
Age: 45
Posts: 1
Rep Power:
0
վոշմի վեռնագիր
[removed by administrator: you have one warning, read forum
rules
and behave correspondingly]
hrayr
View Public Profile
Find More Posts by hrayr
«
Previous Thread
|
Next Thread
»
Thread Tools
Show Printable Version
Реклама
:
Buy text link
.
All times are GMT. The time now is
20:39
.
Mark Forums Read
|
View Forum Leaders
-- Blue
-- Yellow
-- English (US)
-- Русский
Top
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.