Home


Pecobians.com
Excellence is our Patent - Try Pirating!
Just a small c question
Moderator
Moderator

Joined:11 Feb 2005
Posts:1086
Location:Gurgaon
                
Status: Offline
if i have a statement
a = 512, 1024;

what will be the value of a and why??
Privileged Member
Privileged Member

Joined:11 Feb 2005
Posts:521
Location:In front of the Screen!!!
                
Status: Offline
error!!!!!!!

vaise 'a' hai kya?? int, string....
Moderator
Moderator

Joined:11 Feb 2005
Posts:1086
Location:Gurgaon
                
Status: Offline
int ...
The Acid Tongue
The Acid Tongue

Joined:03 Feb 2005
Posts:1080
Location:2199 A.D. - The Time Machine Broke Down
                
Status: Offline
it moves round and round...... i suppose!


when it reaches the largest possible value, the next value it takes is the smallest value it can take and so on.....


but whats the funda,? use long int!
Moderator
Moderator

Joined:11 Feb 2005
Posts:1086
Location:Gurgaon
                
Status: Offline
@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
Moderator

Joined:14 Feb 2005
Posts:370
Location:College Park, MD
                
Status: Offline
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
Moderator

Joined:11 Feb 2005
Posts:1086
Location:Gurgaon
                
Status: Offline
yupz, correct....
another question tmrw....
All times are GMT + 5.5 Hours  
Page 1 of 1