| Just a small c question |
|
Moderator
![]()
|
if i have a statement
a = 512, 1024; what will be the value of a and why?? |
||||||||||||||||
|
|
|||||||||||||||||
|
Privileged Member
![]()
|
error!!!!!!!
vaise 'a' hai kya?? int, string.... |
||||||||||||||||
|
|
|||||||||||||||||
|
Moderator
![]()
|
int ...
|
||||||||||||||||
|
|
|||||||||||||||||
|
Moderator
![]()
|
@smitz: nopes you are completely off the mark...C doesnt see that as a single number as the "," here is not interpreted as in english...
|
||||||||||||||||
|
|
|||||||||||||||||
|
Moderator
![]()
|
For the way that you wrote it, a will be 512. However, if you say
a = (512,1024); the answer will be 1024. In the first case, the "comma" operator, which has even lower precedence than the assignment operator, is ignored. In the second case, the parantheses help put it in action and the regular usage of the "comma" operator comes into play. |
||||||||||||||||
|
|
|||||||||||||||||
|
Moderator
![]()
|
yupz, correct....
another question tmrw.... |
||||||||||||||||
|
|
|||||||||||||||||
|
||
Copyright © 2005 PECOBIANS.COM. All rights reserved
Site Maintained & Developed by Lord PEC
Disclaimer | Privacy Policy
Based on phpBB © phpBB Group & PS


