Re: [algogeeks] Re: C-question

2011-08-23 Thread Sanjay Rajpal
to clear ur these concepts , i think u should refer to Programming in C , Schaum series, Byron S Gottfried, and then Ritchie book. They are clearly given there. Sanju :) On Mon, Aug 22, 2011 at 11:25 PM, Vijay Khandar wrote: > Thanks ...got it.. > > > On Tue, Aug 23, 2011 at 11:30 AM,

Re: [algogeeks] Re: C-question

2011-08-22 Thread Vijay Khandar
Thanks ...got it.. On Tue, Aug 23, 2011 at 11:30 AM, binayakranjan das wrote: > In this case = has right to left associativity and as such < has no > associativity.but,the parsing occurs from left to right.so first (x is checked which evaluates to 0 then (0 that is what is assigned to i

[algogeeks] Re: C-question

2011-08-22 Thread binayakranjan das
In this case = has right to left associativity and as such < has no associativity.but,the parsing occurs from left to right.so first (x wrote: > main() > { > int x=10,y=10,z=5; > int i=x pf("\n%d",i); > > } > > o/p is 1 .pls any1 explain me hw is it printing? -- You received this message because

Re: [algogeeks] Re: c question what is output?

2011-08-21 Thread Dipankar Patro
+1 to 16. whats the confusion here? On 21 August 2011 16:44, sagar pareek wrote: > Arey yaar just see the my post... > i explained it step by step :) > > > On Sun, Aug 21, 2011 at 4:43 PM, Sanjay Rajpal wrote: > >> 16 >> >> 8*(8-1*(8-1-1)) >> >> >> Sanju >> :) >> >> >> >> On Sun, Aug 21, 2011

Re: [algogeeks] Re: c question what is output?

2011-08-21 Thread sagar pareek
Arey yaar just see the my post... i explained it step by step :) On Sun, Aug 21, 2011 at 4:43 PM, Sanjay Rajpal wrote: > 16 > > 8*(8-1*(8-1-1)) > > > Sanju > :) > > > > On Sun, Aug 21, 2011 at 4:10 AM, Anjul Sharma wrote: > >> is 336 the answer?? >> >> On Aug 21, 11:10 am, SuDhir mIsHra wrote:

Re: [algogeeks] Re: c question what is output?

2011-08-21 Thread Sanjay Rajpal
16 8*(8-1*(8-1-1)) Sanju :) On Sun, Aug 21, 2011 at 4:10 AM, Anjul Sharma wrote: > is 336 the answer?? > > On Aug 21, 11:10 am, SuDhir mIsHra wrote: > > #include > > #define FUNC1(i) (i*(i-1)) > > #define FUNC2(i) (i==0?1:i*FUNC1(i-1)) > > main() > > { > > int i=8; > > > > p

[algogeeks] Re: c question what is output?

2011-08-21 Thread Anjul Sharma
is 336 the answer?? On Aug 21, 11:10 am, SuDhir mIsHra wrote: > #include > #define FUNC1(i) (i*(i-1)) > #define FUNC2(i) (i==0?1:i*FUNC1(i-1)) > main() > { >         int i=8; > >         printf("\n%d",FUNC2(i)); > > > > > > > > } -- You received this message because you are subscribed to the Go

Re: [algogeeks] Re: C question.. increment decrement operator..

2011-08-07 Thread UTKARSH SRIVASTAV
but these questions don't have an algo On Sun, Aug 7, 2011 at 2:08 PM, Gary Drocella wrote: > I thought this was algogeeks, not company question geeks. > > On Aug 7, 4:27 pm, UTKARSH SRIVASTAV wrote: > > please these questions are compiler dependent and have no standard > > answers...th

[algogeeks] Re: C question.. increment decrement operator..

2011-08-07 Thread Gary Drocella
I thought this was algogeeks, not company question geeks. On Aug 7, 4:27 pm, UTKARSH SRIVASTAV wrote: > please these questions are compiler dependent and have no standard > answers...these are rarely asked by companies > > > > > > > > > > On Sun, Aug 7, 2011 at 1:23 PM, Gary Drocella wro

Re: [algogeeks] Re: C question.. increment decrement operator..

2011-08-07 Thread UTKARSH SRIVASTAV
please these questions are compiler dependent and have no standard answers...these are rarely asked by companies On Sun, Aug 7, 2011 at 1:23 PM, Gary Drocella wrote: > @puneet The provided faq is garbage, if you want to learn about the > semantics of the C programming > language, then re

[algogeeks] Re: C question.. increment decrement operator..

2011-08-07 Thread Gary Drocella
@puneet The provided faq is garbage, if you want to learn about the semantics of the C programming language, then refer to this original ISO spec here http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf I also suggest that for all programming languages (OCaml, Ruby, lua script, etc) It is de

Re: [algogeeks] Re: C question.. increment decrement operator..

2011-08-07 Thread Puneet Gautam
Also guys, this link: http://c-faq.com/~scs/cgi-bin/faqcat.cgi?sec=expr discusses erroneous expns like a[i]=i++; But if u run this code..this gives no error on GNU compiler.. So, are we really referring to a reliable document here..? http://c-faq.com/~scs/cgi-bin/faqcat.cgi?sec=expr I really do

Re: [algogeeks] Re: C question.. increment decrement operator..

2011-08-07 Thread Puneet Gautam
@ Amit: Well, the link you have posted refers that i++*i++ is not an invalid expression, it just runs differently on different OS's because every OS has a different implementation on how to solve such expressions that use the same address space(Address of the integer i). As far as i know the value

[algogeeks] Re: C question.. increment decrement operator..

2011-08-03 Thread Arun
What Amit told is exactly correct. But I would like to know the expression evaluation order of this in gcc and turboc Arun On Aug 3, 6:15 pm, Arun Vishwanathan wrote: > @amit:+1 > > On Wed, Aug 3, 2011 at 3:14 PM, amit karmakar > wrote: > > > > > > > > > You are wrong. > > The above program in

Re: [algogeeks] Re: C question.. increment decrement operator..

2011-08-03 Thread Arun Vishwanathan
@amit:+1 On Wed, Aug 3, 2011 at 3:14 PM, amit karmakar wrote: > You are wrong. > The above program invokes undefined behavior. Read the standard > language draft to know about sequence points, side effects and > undefined behavior. > > Between a previous and next sequence point a variable's value

[algogeeks] Re: C question.. increment decrement operator..

2011-08-03 Thread amit karmakar
You are wrong. The above program invokes undefined behavior. Read the standard language draft to know about sequence points, side effects and undefined behavior. Between a previous and next sequence point a variable's value cannot be modified twice. c-faq should be quite useful http://c-faq.com/~s

[algogeeks] Re: C Question

2011-06-11 Thread vikas kumar
x is a pointer which can be changed from out side and stores the pointers for int* On Jun 8, 10:58 am, Vishal Thanki wrote: > Following declaration makes the "x" as a volatile pointer to an integer. > > int *volatile x; > > But what does following means? > > int **volatile x; > > ~Vishal -- You

[algogeeks] Re: C++ question.

2006-03-08 Thread Arun
hi pramod, thanks for the direction. i didnt know abt function objects before.definitely helped me. On 3/2/06, pramod <[EMAIL PROTECTED]> wrote: you can have function objects, i.e., objects which behave likefunctions with overloading the () operator. Define a base class like"base_functor" and for e

[algogeeks] Re: C++ question.

2006-03-02 Thread pramod
you can have function objects, i.e., objects which behave like functions with overloading the () operator. Define a base class like "base_functor" and for each different function pointer, define a new class which will store this function pointer and whose operator () will take the same parameters

[algogeeks] Re: C++ question.

2006-03-02 Thread Gene
Arun wrote: > icant use void *, because,i wudnt know how to typecast back. > for eg: if map[a]=char * (*fptr1)(char*,int*) > map[b]=float (*fptr2)(obj1) > so on > if my string is b then map[b] will give some void ptr, how do i know to > typecast it to float (*fptr1)(ob

[algogeeks] Re: C++ question.

2006-03-02 Thread Arun
icant use void *, because,i wudnt know how to typecast back. for eg: if map[a]=char * (*fptr1)(char*,int*)     map[b]=float (*fptr2)(obj1) so on if my string is b then map[b] will give some void ptr, how do i know to typecast it to float (*fptr1)(obj1)? i have about 10 dif

[algogeeks] Re: C++ question.

2006-03-02 Thread milochen
I couldn't ensure that what problem be with you. If you need some pointer point to many kind of types or User-defined type, you could need void* within your declaration. But using it be careful, since any type of pointer could be accept by complier . --~--~-~--~~~---