DIR Return Create A Forum - Home
---------------------------------------------------------
techsuns
HTML https://techsuns.createaforum.com
---------------------------------------------------------
*****************************************************
DIR Return to: OutPut of a Program
*****************************************************
#Post#: 254--------------------------------------------------
Re: What is the output
By: kpr29 Date: November 28, 2012, 2:16 am
---------------------------------------------------------
@Kranthi: Type casting has to be done for Total_elements as int
otherwise it is take as unsigned.....value will be lessthan 1,
so nothing is printed........
#Post#: 267--------------------------------------------------
Re: What is the output
By: ravusairam Date: November 29, 2012, 10:04 pm
---------------------------------------------------------
Answer is when comparision is done comparision operator compares
equal data types, if one is lesser it converts into a higher
data type,
in our case int is converted to unsigned by adding UINT_MAX to
-1 which is greater than TOTAL _ELEMENTS, hence condition fails
every time.
#Post#: 270--------------------------------------------------
Re: What is the output
By: kranthipls Date: November 29, 2012, 10:14 pm
---------------------------------------------------------
A good one
#Post#: 287--------------------------------------------------
Re: What is the output
By: sai124 Date: November 30, 2012, 10:47 pm
---------------------------------------------------------
A nice post techie.
#Post#: 288--------------------------------------------------
Re: What is the output
By: satya Date: November 30, 2012, 10:48 pm
---------------------------------------------------------
nice one techie........i also first felt that all the elements
will be printed,,,,,,,but later i got it............ post
such type of small but tricky questions......its
interesting................... ;) ;)
*****************************************************
DIR Next Page