I cant get to you..please explain...what will first statement expanded to during compilation..??.and why 0 is converted to base..i know exp3 is convertered to exp to..so int to array..???base array comes in int???and what is 0??what if we have 1 in case of 0?
On Thu, Nov 1, 2012 at 5:20 PM, Saurabh Kumar <[email protected]> wrote: > There's nothing to do with the type of "A String". > The reason for which the first code gives compilation error is: operator > (<<) has higher precedence than ternary operator (?:) so, without braces > your are actually messing up the parsing of "cout << << << "stream. > > * cout << test ? "A String" : 0 << endl; * > > consider removing the last "*<<endl*". It shall give no compilation error. > > * cout << test ? "A String" : 0;* // this compiles and runs fine with my > compiler(g++ 4.5), but as *cout << test* will take precedence, there is > no point of putting a ternary operator there, unless you use braces, of > course. > > > In teh second case however, reason given is valid: > i.e. return type of ternary operator is determined by "A String" and the > expression 0 will be taken as address of a string location. Hence, there is > no guarantee of output. > > > On 31 October 2012 19:52, rahul sharma <[email protected]> wrote: > >> plz read carefully >> >> >> On Wed, Oct 31, 2012 at 10:18 AM, Tamanna Afroze <[email protected]>wrote: >> >>> sorry for my last post, i didn't look carefully at the code. I think >>> without bracket the ternary expression is incomplete, that's why; first >>> code doesn't compile correctly. >>> >>> >>> >>> On Wed, Oct 31, 2012 at 9:51 AM, Tamanna Afroze <[email protected]>wrote: >>> >>>> both codes are same. Where is the difference? >>>> >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Algorithm Geeks" group. >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]. >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
