Re: [algogeeks] Re: find output

2011-07-05 Thread Vishal Thanki
+1 @Sankalp On Tue, Jul 5, 2011 at 5:02 PM, sankalp srivastava wrote: > A better place to put these types of questions would be www.stackoverflow.com > > On Jul 4, 10:45 pm, amit kumar wrote: >> thanx guys... >> >> On Mon, Jul 4, 2011 at 5:11 PM, mahesh.jnumc...@gmail.com < >> >> >> >> >> >> >>

[algogeeks] Re: find output

2011-07-05 Thread sankalp srivastava
A better place to put these types of questions would be www.stackoverflow.com On Jul 4, 10:45 pm, amit kumar wrote: > thanx guys... > > On Mon, Jul 4, 2011 at 5:11 PM, mahesh.jnumc...@gmail.com < > > > > > > > > mahesh.jnumc...@gmail.com> wrote: > > In while loop, the value of i will be used as 0

Re: [algogeeks] Re: find output.

2011-06-16 Thread LALIT SHARMA
@amit , Then explain me , in simpler words .. as i am not able to get it ... On 6/17/11, Anand wrote: > Question: > main() > { > char str[] = "hai friends"; > char *p,*p1; > p = str; > p1=p; > while(*p != 's') > { > ++*p++; > > } > printf(" %s",p1); > } > http://codepad.org/

Re: [algogeeks] Re: find output.

2011-06-16 Thread Anand
Question: main() { char str[] = "hai friends"; char *p,*p1; p = str; p1=p; while(*p != 's') { ++*p++; } printf(" %s",p1); } http://codepad.org/24hmvzP5 Ans: ibj!gsjfoes On Thu, Jun 16, 2011 at 9:24 AM, sunny agrawal wrote: > @Arpit > Thanks to Bruce Eckel :D > > > On Thu,

Re: [algogeeks] Re: find output.

2011-06-16 Thread sunny agrawal
@Arpit Thanks to Bruce Eckel :D On Thu, Jun 16, 2011 at 9:00 PM, Arpit Sood wrote: > @sunny thanks, that post did clear the confusion. > > > On Thu, Jun 16, 2011 at 8:17 PM, Navneet Gupta wrote: > >> Then i would suggest you give the original reference in such cases for >> still better understan

Re: [algogeeks] Re: find output.

2011-06-16 Thread Arpit Sood
@sunny thanks, that post did clear the confusion. On Thu, Jun 16, 2011 at 8:17 PM, Navneet Gupta wrote: > Then i would suggest you give the original reference in such cases for > still better understanding :) > Be it a book or a website. > > > On Thu, Jun 16, 2011 at 8:13 PM, sunny agrawal wrote:

Re: [algogeeks] Re: find output.

2011-06-16 Thread Navneet Gupta
Then i would suggest you give the original reference in such cases for still better understanding :) Be it a book or a website. On Thu, Jun 16, 2011 at 8:13 PM, sunny agrawal wrote: > yes copy pasting the exact thing :) > for better understanding :) > > On Thu, Jun 16, 2011 at 8:06 PM, Navneet Gu

Re: [algogeeks] Re: find output.

2011-06-16 Thread sunny agrawal
yes copy pasting the exact thing :) for better understanding :) On Thu, Jun 16, 2011 at 8:06 PM, Navneet Gupta wrote: > @Sunny, it is good that you follow Bruce Eckel, but copy pasting the exact > thing? :) > > > On Thu, Jun 16, 2011 at 7:34 PM, keyan karthi > wrote: > >> "hi friends" is a strin

Re: [algogeeks] Re: find output.

2011-06-16 Thread Navneet Gupta
@Sunny, it is good that you follow Bruce Eckel, but copy pasting the exact thing? :) On Thu, Jun 16, 2011 at 7:34 PM, keyan karthi wrote: > "hi friends" is a string literal.. ie the string "hi friends" is stored > somewhere and a pointer to its base address is returned to pointer p at the > time

Re: [algogeeks] Re: find output.

2011-06-16 Thread keyan karthi
"hi friends" is a string literal.. ie the string "hi friends" is stored somewhere and a pointer to its base address is returned to pointer p at the time of initialization... u can always make use of this pointer to traverse / access the "literal" but u cant "alter tat" in the code, u r trying to do

Re: [algogeeks] Re: find output.

2011-06-16 Thread Kamakshii Aggarwal
i still din't get the solution..please explain.. On 6/16/11, LALIT SHARMA wrote: > ++*p++ > ==> > ++(*p++) , > increments the value stored at p , and also increments p . > > > > On Thu, Jun 16, 2011 at 1:10 PM, sunny agrawal > wrote: > >> The place where strict constness is not enforced is with c

Re: [algogeeks] Re: find output.

2011-06-16 Thread amit kumar
lalit u r wrong On Thu, Jun 16, 2011 at 1:44 PM, LALIT SHARMA wrote: > ++*p++ > ==> > ++(*p++) , > increments the value stored at p , and also increments p . > > > > > On Thu, Jun 16, 2011 at 1:10 PM, sunny agrawal wrote: > >> The place where strict constness is not enforced is with character >>

Re: [algogeeks] Re: find output.

2011-06-16 Thread LALIT SHARMA
++*p++ ==> ++(*p++) , increments the value stored at p , and also increments p . On Thu, Jun 16, 2011 at 1:10 PM, sunny agrawal wrote: > The place where strict constness is not enforced is with character > array literals. You can say > char* cp = "howdy"; > and the compiler will accept it witho

Re: [algogeeks] Re: find output.

2011-06-16 Thread sunny agrawal
The place where strict constness is not enforced is with character array literals. You can say char* cp = "howdy"; and the compiler will accept it without complaint. This is technically an error because a character array literal (“howdy” in this case) is created by the compiler as a constant charac

Re: [algogeeks] Re: find output.

2011-06-16 Thread amit kumar
//kk //In place of char *p="hai friends",*p1; if i declare as char p[]="hai friends"; char *p1; //then ?? On Thu, Jun 16, 2011 at 8:16 AM, DIPANKAR DUTTA wrote: > It's ok.. > > char *p="hai friends"...not correct > > bcz you did allocate memory for that string but assiging poiter to the base

Re: [algogeeks] Re: find output.

2011-06-15 Thread DIPANKAR DUTTA
It's ok.. char *p="hai friends"...not correct bcz you did allocate memory for that string but assiging poiter to the base address.. from where gcc will get the bse address of that string when u r not actually allocate memory for it? thus it generate SIGSEG signal and give invalid memory addre

[algogeeks] Re: find output.

2011-06-15 Thread DK
Gives me a SEGFAULT on gcc. Probably due to undefined behaviour. -- DK http://twitter.com/divyekapoor http://www.divye.in -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussion on the web visit https://groups.google.com/d/