Re: [algogeeks] C output
#includestdio.h int main() { char str[]={'a','b','c'}; char str1[]={abc}; printf(%d,sizeof(str)); printf(%d,sizeof(str1)); getchar(); } This is giving 3 in case of str and 4 in case of str1 bcz str is array of character and str1 is a string. For understanding this point consider a integer array int arr[] = {1,2,3,4}; then for this sizeof(arr) is 16 means 4*sizeof(int). So in the same way for str in given program it is giving 3*sizeof(char) i.e. 3. sizeof(anyString) = lengthOfString +1 ( +1 for '\0') strlen(anyString) = simple length sizeof(anyArray) = numberofElementPresentInArray*sizeof(dataType) -- *Thanks,* *Vikas Kumar* * * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output
@rahul According to C specification, half filled array will be filled with value 0. In your example you are setting str[0] as 'g' and str[1] as 'k'. So the compiler sets str[29] as 0. So you string str becomes {'g', 'k', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0'} Confusion is arising from the fact that you have created an array of 10 elements. To answer you original question gk is inherently {'g', 'k', '\0'} and has size 3 while {'g', 'k'} has size 2. Regards, Sachin On Saturday, October 6, 2012 9:34:30 PM UTC+5:30, rahul sharma wrote: #includestdio.h int main() { char str[10]={'g','k'}; char str1[10]=gh; int i; for(i=0;str1[i]!=NULL;i++) printf(%c,str[i]); getchar(); } NUll is there in character array also...make clear me... On Sat, Oct 6, 2012 at 9:22 PM, rahul sharma rahul2...@gmail.comjavascript: wrote: int main() { char str[10]={'g','k'}; char str1[10]=gh; printf(%s,str); printf(%s,str1); getchar(); } then how does this work??? str printing gk...then NULL is automatically appended in this also...plz tell On Sat, Oct 6, 2012 at 6:33 PM, Rathish Kannan rathis...@gmail.comjavascript: wrote: For string, C appends '\0' internally. hence sizeof(str) returned the value 3. str1 is char array with two character. hence sizeof(str1) returned the value 2. -- RK :) On Sat, Oct 6, 2012 at 5:53 PM, rahul sharma rahul2...@gmail.comjavascript: wrote: char str[]=ab; char str1[]={'a','b'}; sizeof(str) ...o/p is 3 sizeof(str1)o/p is 2.. Why so plz explain... -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algo...@googlegroups.comjavascript: . To unsubscribe from this group, send email to algogeeks+...@googlegroups.com javascript:. 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 algo...@googlegroups.comjavascript: . To unsubscribe from this group, send email to algogeeks+...@googlegroups.com javascript:. 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 view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/65EsWyTnMlEJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output
@sachin..thnx for explanation..got it..plz tell #includestdio.h int main() { char str[]={'a','b','c'}; char str1[]={abc}; printf(%d,sizeof(str)); printf(%d,sizeof(str1)); getchar(); } why str has size 3 and str1 has 4...NUll should also come after c of str???then y 3?? On Mon, Oct 8, 2012 at 5:07 PM, Sachin sachin.maheshw...@gmail.com wrote: @rahul According to C specification, half filled array will be filled with value 0. In your example you are setting str[0] as 'g' and str[1] as 'k'. So the compiler sets str[29] as 0. So you string str becomes {'g', 'k', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0'} Confusion is arising from the fact that you have created an array of 10 elements. To answer you original question gk is inherently {'g', 'k', '\0'} and has size 3 while {'g', 'k'} has size 2. Regards, Sachin On Saturday, October 6, 2012 9:34:30 PM UTC+5:30, rahul sharma wrote: #includestdio.h int main() { char str[10]={'g','k'}; char str1[10]=gh; int i; for(i=0;str1[i]!=NULL;i++) printf(%c,str[i]); getchar(); } NUll is there in character array also...make clear me... On Sat, Oct 6, 2012 at 9:22 PM, rahul sharma rahul2...@gmail.com wrote: int main() { char str[10]={'g','k'}; char str1[10]=gh; printf(%s,str); printf(%s,str1); getchar(); } then how does this work??? str printing gk...then NULL is automatically appended in this also...plz tell On Sat, Oct 6, 2012 at 6:33 PM, Rathish Kannan rathis...@gmail.comwrote: For string, C appends '\0' internally. hence sizeof(str) returned the value 3. str1 is char array with two character. hence sizeof(str1) returned the value 2. -- RK :) On Sat, Oct 6, 2012 at 5:53 PM, rahul sharma rahul2...@gmail.comwrote: char str[]=ab; char str1[]={'a','b'}; sizeof(str) ...o/p is 3 sizeof(str1)o/p is 2.. Why so plz explain... -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algo...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+...@** googlegroups.com. For more options, visit this group at http://groups.google.com/** group/algogeeks?hl=en 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 algo...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+...@** googlegroups.com. For more options, visit this group at http://groups.google.com/** group/algogeeks?hl=en http://groups.google.com/group/algogeeks?hl=en. -- 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/msg/algogeeks/-/65EsWyTnMlEJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] C output
char str[]=ab; char str1[]={'a','b'}; sizeof(str) ...o/p is 3 sizeof(str1)o/p is 2.. Why so plz explain... -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output
because of null char in 1st On Sat, Oct 6, 2012 at 5:53 PM, rahul sharma rahul23111...@gmail.comwrote: char str[]=ab; char str1[]={'a','b'}; sizeof(str) ...o/p is 3 sizeof(str1)o/p is 2.. Why so plz explain...-- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output
For string, C appends '\0' internally. hence sizeof(str) returned the value 3. str1 is char array with two character. hence sizeof(str1) returned the value 2. -- RK :) On Sat, Oct 6, 2012 at 5:53 PM, rahul sharma rahul23111...@gmail.comwrote: char str[]=ab; char str1[]={'a','b'}; sizeof(str) ...o/p is 3 sizeof(str1)o/p is 2.. Why so plz explain... -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output
int main() { char str[10]={'g','k'}; char str1[10]=gh; printf(%s,str); printf(%s,str1); getchar(); } then how does this work??? str printing gk...then NULL is automatically appended in this also...plz tell On Sat, Oct 6, 2012 at 6:33 PM, Rathish Kannan rathishkan...@gmail.comwrote: For string, C appends '\0' internally. hence sizeof(str) returned the value 3. str1 is char array with two character. hence sizeof(str1) returned the value 2. -- RK :) On Sat, Oct 6, 2012 at 5:53 PM, rahul sharma rahul23111...@gmail.comwrote: char str[]=ab; char str1[]={'a','b'}; sizeof(str) ...o/p is 3 sizeof(str1)o/p is 2.. Why so plz explain... -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output
#includestdio.h int main() { char str[10]={'g','k'}; char str1[10]=gh; int i; for(i=0;str1[i]!=NULL;i++) printf(%c,str[i]); getchar(); } NUll is there in character array also...make clear me... On Sat, Oct 6, 2012 at 9:22 PM, rahul sharma rahul23111...@gmail.comwrote: int main() { char str[10]={'g','k'}; char str1[10]=gh; printf(%s,str); printf(%s,str1); getchar(); } then how does this work??? str printing gk...then NULL is automatically appended in this also...plz tell On Sat, Oct 6, 2012 at 6:33 PM, Rathish Kannan rathishkan...@gmail.comwrote: For string, C appends '\0' internally. hence sizeof(str) returned the value 3. str1 is char array with two character. hence sizeof(str1) returned the value 2. -- RK :) On Sat, Oct 6, 2012 at 5:53 PM, rahul sharma rahul23111...@gmail.comwrote: char str[]=ab; char str1[]={'a','b'}; sizeof(str) ...o/p is 3 sizeof(str1)o/p is 2.. Why so plz explain... -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output
violation of sequence point ruleoutput depends on compiler to compiler. On Tue, Jul 3, 2012 at 1:22 PM, rahul sharma rahul23111...@gmail.comwrote: #includestdio.h #includeconio.h int main() { int i; i=5; i=++i/i++; printf(%d,i); getch(); } Why o/p is 1 and not 2?? what happened for post increment??? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] c output
#includestdio.h int main() { double p=fabs(24.9996); double t=fabs(25.0003); printf(%0.3lf %0.3lf\n,p,t); if(fabs(p)==fabs(t)) printf(equal);// why this not executed? } why the equal not printed in this code...? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] c output
printf(%0.3lf %0.3lf\n,p,t); its just printing at your convenience . you are not changing the value of p,t . change this statement to printf(%0.5lf %0.5lf\n,p,t); On Tue, Jan 17, 2012 at 11:27 AM, dabbcomputers dabbcomput...@gmail.comwrote: #includestdio.h int main() { double p=fabs(24.9996); double t=fabs(25.0003); printf(%0.3lf %0.3lf\n,p,t); if(fabs(p)==fabs(t)) printf(equal);// why this not executed? } why the equal not printed in this code...? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] c output
atul he is assigning the value later on. i think format specifier . rounds up the number in last decimal place. On Tue, Jan 17, 2012 at 11:53 AM, atul anand atul.87fri...@gmail.comwrote: printf(%0.3lf %0.3lf\n,p,t); its just printing at your convenience . you are not changing the value of p,t . change this statement to printf(%0.5lf %0.5lf\n,p,t); On Tue, Jan 17, 2012 at 11:27 AM, dabbcomputers dabbcomput...@gmail.comwrote: #includestdio.h int main() { double p=fabs(24.9996); double t=fabs(25.0003); printf(%0.3lf %0.3lf\n,p,t); if(fabs(p)==fabs(t)) printf(equal);// why this not executed? } why the equal not printed in this code...? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] c output
It's not a good way to compare two floats directly using =, try something like below: http://ideone.com/c65Vl -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] c output
i gues atul is crkt. its jst printin by user convenience...when actually d two are not equal... i guess the code...xplains well...dats y equal is not printed..out #includestdio.hint main(){ double p=fabs(24.9996); printf(%lf\n,p); double t=fabs(25.0003); printf(%lf\n,t); printf(%0.3lf %0.3lf\n,p,t); printf(%lf\n%lf\n,fabs(p),fabs(t)); if(fabs(p)==fabs(t)) printf(equal);// why this not executed?} crkt me if i'm wrong.. Regards, PAYAL GUPTA, NIT-BHOPAL.. On Tue, Jan 17, 2012 at 12:13 PM, shady sinv...@gmail.com wrote: atul he is assigning the value later on. i think format specifier . rounds up the number in last decimal place. On Tue, Jan 17, 2012 at 11:53 AM, atul anand atul.87fri...@gmail.comwrote: printf(%0.3lf %0.3lf\n,p,t); its just printing at your convenience . you are not changing the value of p,t . change this statement to printf(%0.5lf %0.5lf\n,p,t); On Tue, Jan 17, 2012 at 11:27 AM, dabbcomputers dabbcomput...@gmail.comwrote: #includestdio.h int main() { double p=fabs(24.9996); double t=fabs(25.0003); printf(%0.3lf %0.3lf\n,p,t); if(fabs(p)==fabs(t)) printf(equal);// why this not executed? } why the equal not printed in this code...? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] c output ??
@amol this is not the behaviour of printf, its totally about the typecasting -- 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/msg/algogeeks/-/GPVlt15S3V0J. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] c output ??
It's painful to see printf being accused for the (un) expected output..The declaration of printf means that any data type can be passed to it as argument.Inherently what printf does is print the bytes in meaningful form according to the first argument which is a string.So its impossible for printf to typecast arguments once they are passed they appear the same way to printf...*A stream of bits from which it has to extract the valid info.*Its the responsibility of the programmer to pass the right data type with right format specifier...Just to complete my answer http://www.ideone.com/CNkCo . Saurabh Singh B.Tech (Computer Science) MNNIT blog:geekinessthecoolway.blogspot.com On Tue, Jan 10, 2012 at 2:29 PM, Rahul Verma rahulverma@gmail.comwrote: @amol this is not the behaviour of printf, its totally about the typecasting -- 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/msg/algogeeks/-/GPVlt15S3V0J. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] c output ??
According to KR the behavior of printf is undefined if u do not use correct format specifiers for the variables. -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad http://gplus.to/amolsharma99 http://twitter.com/amolsharma99http://in.linkedin.com/pub/amol-sharma/21/79b/507http://www.simplyamol.blogspot.com/ http://youtube.com/amolsharma99 On Mon, Jan 9, 2012 at 11:01 AM, atul anand atul.87fri...@gmail.com wrote: take care when ever you use %d and %f %d is not flexible in handling float varibaledo not expect it to typecast itself. reason could be , you are trying to fit large data type i.e float to the int whose range is less. whereas in second case float can incorporate int type , so automatic typecasting is done. On Mon, Jan 9, 2012 at 10:17 AM, HARSHIT PAHUJA hpahuja.mn...@gmail.comwrote: *#includestdio.h int main() { float f=25.25; printf(%d\n,f); long int x=90; printf(%f,x); return 0; } * above program gives output *0 25.25* shudn it be : *25 90.* ?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] c output ??
@amol I think it is not the behaviour of printf -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] c output ??
*#includestdio.h int main() { float f=25.25; printf(%d\n,f); long int x=90; printf(%f,x); return 0; } * above program gives output *0 25.25* shudn it be : *25 90.* ?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] c output ??
take care when ever you use %d and %f %d is not flexible in handling float varibaledo not expect it to typecast itself. reason could be , you are trying to fit large data type i.e float to the int whose range is less. whereas in second case float can incorporate int type , so automatic typecasting is done. On Mon, Jan 9, 2012 at 10:17 AM, HARSHIT PAHUJA hpahuja.mn...@gmail.comwrote: *#includestdio.h int main() { float f=25.25; printf(%d\n,f); long int x=90; printf(%f,x); return 0; } * above program gives output *0 25.25* shudn it be : *25 90.* ?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output????
@arun: http://mindprod.com/jgloss/immutable.html this might help you, in essense, if a compiler treats them as immutable, the reason is to reduce the overhead of creating another contant literal (as explain at the link, the string literals are the most commonly used) this is from a java (or higher than C languages) just got to know that this is in C too... -- 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/msg/algogeeks/-/vcZVkFcVEwoJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output????
depends on compiler i think..but most probably it compares the addresses. On Wed, Jan 4, 2012 at 12:20 PM, saurabh singh saurab...@gmail.com wrote: @all.Your explanations work because probably all of you are using a compiler that's behaving in the same way.Don't conclude from what you see...The compiler is free to store the constant strings the way it wants. Saurabh Singh B.Tech (Computer Science) MNNIT blog:geekinessthecoolway.blogspot.com On Wed, Jan 4, 2012 at 12:13 PM, Rahul raikra...@gmail.com wrote: it's near to a common mis conception that string liberals are in data sections of THE PROGRAM PLEASE READ THE FILE a.out.h and find the difference between initialized data and non initialized data On 9/6/11, Sandy sandy.wad...@gmail.com wrote: String constants (literals) are saved into the .data section of the program, Here is the sample program to show that. if() is essentially comparing the addresses of two pointers which is same. int main() { char *p=persons; char *q=persons; char *r=persons; char *s=persons; printf(%x %x %x %x\n,p,q,r,s); if(p==persons) printf(technical %s,p); else printf(true %s,p); return 0; } - Output: 403021 403021 403021 403021 technical persons On Tue, Sep 6, 2011 at 9:04 PM, sivaviknesh s sivavikne...@gmail.com wrote: main() { char *p=persons; clrscr(); if(p==persons) printf(technical %s,p); else printf(true %s,p); return 0; } ..op : technical persons ..plz explain .. how come it works like an strcmp operation??? -- Regards, $iva -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Sandeep Kumar,* ( Mobile +91-9866507368 *“I believe in smart work, Believe Me”* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output????
actually is there any reason as to why same address is returned to the pointer when both pointers(p and q) are initialised to persons unlike when p[] and q[] =persons? On Tue, Sep 6, 2011 at 9:08 AM, Sandy sandy.wad...@gmail.com wrote: String constants (literals) are saved into the .data section of the program, Here is the sample program to show that. if() is essentially comparing the addresses of two pointers which is same. int main() { char *p=persons; char *q=persons; char *r=persons; char *s=persons; printf(%x %x %x %x\n,p,q,r,s); if(p==persons) printf(technical %s,p); else printf(true %s,p); return 0; } - Output: 403021 403021 403021 403021 technical persons On Tue, Sep 6, 2011 at 9:04 PM, sivaviknesh s sivavikne...@gmail.comwrote: main() { char *p=persons; clrscr(); if(p==persons) printf(technical %s,p); else printf(true %s,p); return 0; } ..op : technical persons ..plz explain .. how come it works like an strcmp operation??? -- Regards, $iva -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Sandeep Kumar,* ( Mobile +91-9866507368 *“I believe in smart work, Believe Me”* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- People often say that motivation doesn't last. Well, neither does bathing - that's why we recommend it daily. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output????
it's near to a common mis conception that string liberals are in data sections of THE PROGRAM PLEASE READ THE FILE a.out.h and find the difference between initialized data and non initialized data On 9/6/11, Sandy sandy.wad...@gmail.com wrote: String constants (literals) are saved into the .data section of the program, Here is the sample program to show that. if() is essentially comparing the addresses of two pointers which is same. int main() { char *p=persons; char *q=persons; char *r=persons; char *s=persons; printf(%x %x %x %x\n,p,q,r,s); if(p==persons) printf(technical %s,p); else printf(true %s,p); return 0; } - Output: 403021 403021 403021 403021 technical persons On Tue, Sep 6, 2011 at 9:04 PM, sivaviknesh s sivavikne...@gmail.comwrote: main() { char *p=persons; clrscr(); if(p==persons) printf(technical %s,p); else printf(true %s,p); return 0; } ..op : technical persons ..plz explain .. how come it works like an strcmp operation??? -- Regards, $iva -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Sandeep Kumar,* ( Mobile +91-9866507368 *“I believe in smart work, Believe Me”* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output????
@all.Your explanations work because probably all of you are using a compiler that's behaving in the same way.Don't conclude from what you see...The compiler is free to store the constant strings the way it wants. Saurabh Singh B.Tech (Computer Science) MNNIT blog:geekinessthecoolway.blogspot.com On Wed, Jan 4, 2012 at 12:13 PM, Rahul raikra...@gmail.com wrote: it's near to a common mis conception that string liberals are in data sections of THE PROGRAM PLEASE READ THE FILE a.out.h and find the difference between initialized data and non initialized data On 9/6/11, Sandy sandy.wad...@gmail.com wrote: String constants (literals) are saved into the .data section of the program, Here is the sample program to show that. if() is essentially comparing the addresses of two pointers which is same. int main() { char *p=persons; char *q=persons; char *r=persons; char *s=persons; printf(%x %x %x %x\n,p,q,r,s); if(p==persons) printf(technical %s,p); else printf(true %s,p); return 0; } - Output: 403021 403021 403021 403021 technical persons On Tue, Sep 6, 2011 at 9:04 PM, sivaviknesh s sivavikne...@gmail.com wrote: main() { char *p=persons; clrscr(); if(p==persons) printf(technical %s,p); else printf(true %s,p); return 0; } ..op : technical persons ..plz explain .. how come it works like an strcmp operation??? -- Regards, $iva -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Sandeep Kumar,* ( Mobile +91-9866507368 *“I believe in smart work, Believe Me”* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] c output
does y goes to d of %*d and it print 5???i hav a doubt On Fri, Oct 28, 2011 at 9:32 PM, amrit harry dabbcomput...@gmail.comwrote: let this statement int x=100,y=5;printf(%*d,x,y); in this line first x is assign to '*' and it become %100d and it will padd 100 spaces before print. and if we use( %*d,x) then x is assign to '*' and garbage value wud be printed. On Fri, Oct 28, 2011 at 8:53 PM, annarao kataru kataruanna...@gmail.comwrote: can u plz tell me what exactly %*d means? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- AMRIT -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] c output
yes 5 will be printed with 99 extra padding spaces. On Sat, Oct 29, 2011 at 4:16 PM, rahul sharma rahul23111...@gmail.comwrote: does y goes to d of %*d and it print 5???i hav a doubt On Fri, Oct 28, 2011 at 9:32 PM, amrit harry dabbcomput...@gmail.comwrote: let this statement int x=100,y=5;printf(%*d,x,y); in this line first x is assign to '*' and it become %100d and it will padd 100 spaces before print. and if we use( %*d,x) then x is assign to '*' and garbage value wud be printed. On Fri, Oct 28, 2011 at 8:53 PM, annarao kataru kataruanna...@gmail.comwrote: can u plz tell me what exactly %*d means? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- AMRIT -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] c output
can u plz tell me what exactly %*d means? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] c output
let this statement int x=100,y=5;printf(%*d,x,y); in this line first x is assign to '*' and it become %100d and it will padd 100 spaces before print. and if we use( %*d,x) then x is assign to '*' and garbage value wud be printed. On Fri, Oct 28, 2011 at 8:53 PM, annarao kataru kataruanna...@gmail.comwrote: can u plz tell me what exactly %*d means? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- AMRIT -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] c output
*explain the o/p...if i/p are 100 200 300 int main() { int a=1,b=2,c=3; scanf(%d %*d %d,a,b,c); printf(%d %d %d,a,b,c); return(0); } *Thanking you *With regards- Raghav garg Contact no. 9013201944 www.facebook.com/rock.raghavag B. tech (IT), 5th sem University School Of Information Technology Guru Govind Singh Indraprastha University Delhi* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] c output
as expected value 100 goes to a,since %*d is variable field width specifier so the input 200 goes for that,and the remaining input 300 goes to b value of c is not change so the output will be: 100 300 3 On Sun, Oct 9, 2011 at 12:22 AM, Raghav Garg rock.ragha...@gmail.comwrote: *explain the o/p...if i/p are 100 200 300 int main() { int a=1,b=2,c=3; scanf(%d %*d %d,a,b,c); printf(%d %d %d,a,b,c); return(0); } *Thanking you *With regards- Raghav garg Contact no. 9013201944 www.facebook.com/rock.raghavag B. tech (IT), 5th sem University School Of Information Technology Guru Govind Singh Indraprastha University Delhi* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] c output
This is what you use if you want *scanf()* to eat some data but you don't want to store it anywhere; you don't give *scanf()* an argument for this conversion On Sun, Oct 9, 2011 at 1:32 AM, shiva@Algo shiv.jays...@gmail.com wrote: as expected value 100 goes to a,since %*d is variable field width specifier so the input 200 goes for that,and the remaining input 300 goes to b value of c is not change so the output will be: 100 300 3 On Sun, Oct 9, 2011 at 12:22 AM, Raghav Garg rock.ragha...@gmail.comwrote: *explain the o/p...if i/p are 100 200 300 int main() { int a=1,b=2,c=3; scanf(%d %*d %d,a,b,c); printf(%d %d %d,a,b,c); return(0); } *Thanking you *With regards- Raghav garg Contact no. 9013201944 www.facebook.com/rock.raghavag B. tech (IT), 5th sem University School Of Information Technology Guru Govind Singh Indraprastha University Delhi* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C OUTPUT
number will be sored in 2'scomplement form .as 4=100 so its 1's comlement form will be 011 and adding 1 to it will result in 011+1=100.so -4 will be printed On Wed, Sep 21, 2011 at 10:23 AM, kartik sachan kartik.sac...@gmail.comwrote: @ravi i think ur concepts is correct the no is stored in 2's formif negative thanks ravi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] C OUTPUT
int main(){ struct { int a:1; int b:3; }obj; obj.b=12; obj.a=7; printf http://www.opengroup.org/onlinepubs/009695399/functions/printf.html(%d %d,obj.b,obj.a);return 0;} can anybody explain the output plzz also show how no's are stored -- *WITH REGARDS,* * * *KARTIK SACHAN* *B.TECH 3rd YEAR* *COMPUTER SCIENCE AND ENGINEERING* *NIT ALLAHABAD* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C OUTPUT
output is -4 -1 int a:1 signifies that only 1 bit will be stored for a and since we have only 1 bit so it will serve as sign bit and we get obj.a as -1 similarly for int b:3, 3 bits will be used to store b. 12 is 1100. we save only 3 bits i.e. 100 where msb signifies the sign i.e. no. is negative. But I am not able to represent the value -4 in 3 bits. Can anyone elaborate? I think 00 is getting converted to 2's complement which is 100 = 4 and we have negative sign bit set. So ans is -4. Correct me if I am wrong. On Wed, Sep 21, 2011 at 10:22 PM, kartik sachan kartik.sac...@gmail.comwrote: int main(){ struct { int a:1; int b:3; }obj; obj.b=12; obj.a=7; printf http://www.opengroup.org/onlinepubs/009695399/functions/printf.html(%d %d,obj.b,obj.a);return 0;} can anybody explain the output plzz also show how no's are stored -- *WITH REGARDS,* * * *KARTIK SACHAN* *B.TECH 3rd YEAR* *COMPUTER SCIENCE AND ENGINEERING* *NIT ALLAHABAD* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards Ravi Maggon B.E. CSE, Final Year Thapar University www.algorithmguru.com *Failure is the opportunity to begin again more intelligently* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C OUTPUT
@ravi i think ur concepts is correct the no is stored in 2's formif negative thanks ravi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] c output
on running,every time i get second a=30... any reasons for that??? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] c output
common guys its undefined acc to standard c On Mon, Sep 19, 2011 at 12:36 PM, Siddhartha Banerjee thefourrup...@gmail.com wrote: on running,every time i get second a=30... any reasons for that??? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] c output
#includestdio.h main() { int a ; a=abc(); printf(\n %d this is fisrt a:,a); a=abc(); printf(\n %d this is second a:,a); } int abc() { int i=23; if(10) return ; i++; return(++ i); } -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] c output
#includestdio.h main() { int a ; a=abc(); printf(\n %d this is fisrt a:,a); a=abc(); printf(\n %d this is second a:,a); } int abc() { int i=23; if(10) return ; i++; return(++ i); } -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] c output
result is not defined by standard c. It doesnt produce compiler error just because return type is int and no value is returned in if(10) basically garbage On Sun, Sep 18, 2011 at 12:23 PM, Bhavesh agrawal agr.bhav...@gmail.comwrote: #includestdio.h main() { int a ; a=abc(); printf(\n %d this is fisrt a:,a); a=abc(); printf(\n %d this is second a:,a); } int abc() { int i=23; if(10) return ; i++; return(++ i); } -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] c output
it is just printing some garbage value as u have specified return but not the value.try putting some value with return then you'll understand what's happening.. -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad http://gplus.to/amolsharma99 http://twitter.com/amolsharma99http://in.linkedin.com/pub/amol-sharma/21/79b/507http://youtube.com/amolsharma99 On Sun, Sep 18, 2011 at 12:38 PM, sukran dhawan sukrandha...@gmail.comwrote: result is not defined by standard c. It doesnt produce compiler error just because return type is int and no value is returned in if(10) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] c output
@what's special in this ... it is giving 0 in both cases. basically a garbage value -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] c output
result is this -1075990972 this is fisrt a: 30 this is second a what is the meaning of a=30 in second call -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] c output
Error. the 10 condition does not return anything, while the function should return an int. On Sun, Sep 18, 2011 at 6:39 AM, hurtlocker bhavesh24...@rediffmail.comwrote: #includestdio.h main() { int a ; a=abc(); printf(\n %d this is fisrt a:,a); a=abc(); printf(\n %d this is second a:,a); } int abc() { int i=23; if(10) return ; i++; return(++ i); } -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Anup Ghatage -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] c output
0 this is fisrt a: 0 this is second a: On Sun, Sep 18, 2011 at 12:09 PM, hurtlocker bhavesh24...@rediffmail.comwrote: #includestdio.h main() { int a ; a=abc(); printf(\n %d this is fisrt a:,a); a=abc(); printf(\n %d this is second a:,a); } int abc() { int i=23; if(10) return ; i++; return(++ i); } -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] c output
another que.. #includestdio.h main() { int a; int i=10; printf(%d %d %d\n,i+++i,i,i---i); printf(%d\n,i---i); a=i---i; printf(%d \n%d,a,i); return 0; } output: 18 10 0 0 0 8 how ?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] c output
again undefined in standard c :) On Sun, Sep 18, 2011 at 1:49 PM, Bhavesh agrawal agr.bhav...@gmail.comwrote: another que.. #includestdio.h main() { int a; int i=10; printf(%d %d %d\n,i+++i,i,i---i); printf(%d\n,i---i); a=i---i; printf(%d \n%d,a,i); return 0; } output: 18 10 0 0 0 8 how ?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] c output,printf(%llx)
usigned long long x = 0x12345678; int a = 0x09; int b = 0x10; printf(a=%x, b=%llx,a,b,c); the result is: a=9,b=123456780010 i wonder why~~ can anyone explain it? thanks. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] c output,printf(%llx)
Check out what u have written... On Sun, Sep 18, 2011 at 7:17 PM, wujin chen wujinchen...@gmail.com wrote: usigned long long x = 0x12345678; int a = 0x09; int b = 0x10; printf(a=%x, b=%llx,a,b,c); the result is: a=9,b=123456780010 i wonder why~~ can anyone explain it? thanks. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- **Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] c output,printf(%llx)
sorry , it should be : usigned long long c = 0x12345678; int a = 0x09; int b = 0x10; printf(a=%x, b=%llx,a,b,c); 2011/9/19 sagar pareek sagarpar...@gmail.com Check out what u have written... On Sun, Sep 18, 2011 at 7:17 PM, wujin chen wujinchen...@gmail.comwrote: usigned long long x = 0x12345678; int a = 0x09; int b = 0x10; printf(a=%x, b=%llx,a,b,c); the result is: a=9,b=123456780010 i wonder why~~ can anyone explain it? thanks. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- **Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output
+1 On Wed, Aug 31, 2011 at 9:27 PM, SANDEEP CHUGH sandeep.aa...@gmail.comwrote: its 4 3 i think On Wed, Aug 31, 2011 at 9:25 PM, aditi garg aditi.garg.6...@gmail.comwrote: 8 3 On Wed, Aug 31, 2011 at 9:22 PM, rohit raman.u...@gmail.com wrote: output?? int main() { char *d = abc\0def\0; printf(%d %d,sizeof(d),strlen(d)); getch(); } -- 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/msg/algogeeks/-/nf_M_Yoep_EJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New Delhi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output
for 16 bit compiler ans is 2 3 for 32 bit compiler ans is 4 3 pls correct me if i m wrong On Wed, Sep 14, 2011 at 11:36 AM, tech coder techcoderonw...@gmail.comwrote: +1 On Wed, Aug 31, 2011 at 9:27 PM, SANDEEP CHUGH sandeep.aa...@gmail.comwrote: its 4 3 i think On Wed, Aug 31, 2011 at 9:25 PM, aditi garg aditi.garg.6...@gmail.comwrote: 8 3 On Wed, Aug 31, 2011 at 9:22 PM, rohit raman.u...@gmail.com wrote: output?? int main() { char *d = abc\0def\0; printf(%d %d,sizeof(d),strlen(d)); getch(); } -- 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/msg/algogeeks/-/nf_M_Yoep_EJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New Delhi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output
for a 32 bit it is 4 ,3 and for 16 bit it is 2,3 and 64 bit it is 8,3.. also strlen(d) gives 3 bcz the coding of fn strlen() is such that as it encounters null it will terminate..so irrespective of machine it prints 3 as null at 4th place -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output
9 and 3 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output
@ prateek absolutely wrong , dear u need to brushup ur basics d is a pointer , it's can be 2 or 4 depebding on compiler On Wed, Sep 14, 2011 at 6:26 AM, PRATEEK VERMA prateek...@gmail.com wrote: 9 and 3 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- * Regards* *The Coder* *Life is a Game. The more u play, the more u win, the more u win , the more successfully u play* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] C output????
main() { char *p=persons; clrscr(); if(p==persons) printf(technical %s,p); else printf(true %s,p); return 0; } ..op : technical persons ..plz explain .. how come it works like an strcmp operation??? -- Regards, $iva -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output????
String literals are saved into a separate table in compiler. So second time when you define persons it wont be created or allocated memory as it already exists in table. On Tue, Sep 6, 2011 at 9:04 PM, sivaviknesh s sivavikne...@gmail.comwrote: main() { char *p=persons; clrscr(); if(p==persons) printf(technical %s,p); else printf(true %s,p); return 0; } ..op : technical persons ..plz explain .. how come it works like an strcmp operation??? -- Regards, $iva -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output????
It is basically comparing the addresses of the two and since p contains the memory address of persons it gives the output as technical persons... infact ull be surprised to see dis #includestdio.h main(){char p[]=persons;char q[]=persons;if(p==q)printf http://www.opengroup.org/onlinepubs/009695399/functions/printf.html(technical %s,p);elseprintf http://www.opengroup.org/onlinepubs/009695399/functions/printf.html(true %s,p);return 0;} output : true persons #includestdio.h main(){char *p=persons;char *q=persons;if(p==q)printf http://www.opengroup.org/onlinepubs/009695399/functions/printf.html(technical %s,p);elseprintf http://www.opengroup.org/onlinepubs/009695399/functions/printf.html(true %s,p);return 0; } bt Here output will be Technical persons On Tue, Sep 6, 2011 at 9:04 PM, sivaviknesh s sivavikne...@gmail.comwrote: main() { char *p=persons; clrscr(); if(p==persons) printf(technical %s,p); else printf(true %s,p); return 0; } ..op : technical persons ..plz explain .. how come it works like an strcmp operation??? -- Regards, $iva -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New Delhi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output????
in case of constant strings..they all return the same pointer..where they are defined.. but in case of non constant strings..like a[]=sumthing and b[]=sumthing...they will have separate memory allocations.. On Tue, Sep 6, 2011 at 9:12 PM, aditi garg aditi.garg.6...@gmail.comwrote: It is basically comparing the addresses of the two and since p contains the memory address of persons it gives the output as technical persons... infact ull be surprised to see dis #includestdio.h main(){char p[]=persons;char q[]=persons;if(p==q) printf http://www.opengroup.org/onlinepubs/009695399/functions/printf.html(technical %s,p);elseprintf http://www.opengroup.org/onlinepubs/009695399/functions/printf.html(true %s,p);return 0;} output : true persons #includestdio.h main(){char *p=persons;char *q=persons;if(p==q) printf http://www.opengroup.org/onlinepubs/009695399/functions/printf.html(technical %s,p);elseprintf http://www.opengroup.org/onlinepubs/009695399/functions/printf.html(true %s,p);return 0; } bt Here output will be Technical persons On Tue, Sep 6, 2011 at 9:04 PM, sivaviknesh s sivavikne...@gmail.comwrote: main() { char *p=persons; clrscr(); if(p==persons) printf(technical %s,p); else printf(true %s,p); return 0; } ..op : technical persons ..plz explain .. how come it works like an strcmp operation??? -- Regards, $iva -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New Delhi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Dheeraj Sharma* Comp Engg. NIT Kurukshetra +91 8950264227 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output????
addresses are compared here i think On Tue, Sep 6, 2011 at 9:04 PM, sivaviknesh s sivavikne...@gmail.comwrote: main() { char *p=persons; clrscr(); if(p==persons) printf(technical %s,p); else printf(true %s,p); return 0; } ..op : technical persons ..plz explain .. how come it works like an strcmp operation??? -- Regards, $iva -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output????
String constants (literals) are saved into the .data section of the program, Here is the sample program to show that. if() is essentially comparing the addresses of two pointers which is same. int main() { char *p=persons; char *q=persons; char *r=persons; char *s=persons; printf(%x %x %x %x\n,p,q,r,s); if(p==persons) printf(technical %s,p); else printf(true %s,p); return 0; } - Output: 403021 403021 403021 403021 technical persons On Tue, Sep 6, 2011 at 9:04 PM, sivaviknesh s sivavikne...@gmail.comwrote: main() { char *p=persons; clrscr(); if(p==persons) printf(technical %s,p); else printf(true %s,p); return 0; } ..op : technical persons ..plz explain .. how come it works like an strcmp operation??? -- Regards, $iva -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Sandeep Kumar,* ( Mobile +91-9866507368 *“I believe in smart work, Believe Me”* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] c output .. help plz
printf(%d,3.14*6.25*6.25); ...ans : 0 ..how and why?? why not type conversion take place?? -- Regards, $iva -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] c output .. help plz
it wil not truncate the floating point to integer remember... On Tue, Sep 6, 2011 at 9:55 PM, sivaviknesh s sivavikne...@gmail.comwrote: printf(%d,3.14*6.25*6.25); ...ans : 0 ..how and why?? why not type conversion take place?? -- Regards, $iva -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] c output .. help plz
coz both floating point are stored in ieee format which is different from integers On Tue, Sep 6, 2011 at 10:18 PM, sukran dhawan sukrandha...@gmail.comwrote: it wil not truncate the floating point to integer remember... On Tue, Sep 6, 2011 at 9:55 PM, sivaviknesh s sivavikne...@gmail.comwrote: printf(%d,3.14*6.25*6.25); ...ans : 0 ..how and why?? why not type conversion take place?? -- Regards, $iva -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output
9 and 3 On Wed, Aug 31, 2011 at 9:22 PM, rohit raman.u...@gmail.com wrote: output?? int main() { char *d = abc\0def\0; printf(%d %d,sizeof(d),strlen(d)); getch(); } -- 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/msg/algogeeks/-/nf_M_Yoep_EJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output
sizeof considers everything between double quotes + /0 character strlen reads until first \0 On Thu, Sep 1, 2011 at 5:49 PM, sukran dhawan sukrandha...@gmail.comwrote: 9 and 3 On Wed, Aug 31, 2011 at 9:22 PM, rohit raman.u...@gmail.com wrote: output?? int main() { char *d = abc\0def\0; printf(%d %d,sizeof(d),strlen(d)); getch(); } -- 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/msg/algogeeks/-/nf_M_Yoep_EJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output
output is machine dependent. On 9/1/11, sukran dhawan sukrandha...@gmail.com wrote: sizeof considers everything between double quotes + /0 character strlen reads until first \0 On Thu, Sep 1, 2011 at 5:49 PM, sukran dhawan sukrandha...@gmail.comwrote: 9 and 3 On Wed, Aug 31, 2011 at 9:22 PM, rohit raman.u...@gmail.com wrote: output?? int main() { char *d = abc\0def\0; printf(%d %d,sizeof(d),strlen(d)); getch(); } -- 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/msg/algogeeks/-/nf_M_Yoep_EJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Anil Arya, Computer Science * *Motilal Nehru National Institute of Technology,Allahabad . * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output
its 4 3 i think On Wed, Aug 31, 2011 at 9:25 PM, aditi garg aditi.garg.6...@gmail.comwrote: 8 3 On Wed, Aug 31, 2011 at 9:22 PM, rohit raman.u...@gmail.com wrote: output?? int main() { char *d = abc\0def\0; printf(%d %d,sizeof(d),strlen(d)); getch(); } -- 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/msg/algogeeks/-/nf_M_Yoep_EJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New Delhi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output
2 3 because d is pointer avriable On Wed, Aug 31, 2011 at 9:25 PM, aditi garg aditi.garg.6...@gmail.comwrote: 8 3 On Wed, Aug 31, 2011 at 9:22 PM, rohit raman.u...@gmail.com wrote: output?? int main() { char *d = abc\0def\0; printf(%d %d,sizeof(d),strlen(d)); getch(); } -- 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/msg/algogeeks/-/nf_M_Yoep_EJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New Delhi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output
i said 4 3 according to 32 bit machine.. if its 16 bit thn it wud be 2 3 On Wed, Aug 31, 2011 at 9:30 PM, sachin goyal monugoya...@gmail.com wrote: 2 3 because d is pointer avriable On Wed, Aug 31, 2011 at 9:25 PM, aditi garg aditi.garg.6...@gmail.comwrote: 8 3 On Wed, Aug 31, 2011 at 9:22 PM, rohit raman.u...@gmail.com wrote: output?? int main() { char *d = abc\0def\0; printf(%d %d,sizeof(d),strlen(d)); getch(); } -- 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/msg/algogeeks/-/nf_M_Yoep_EJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New Delhi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output
sizeof(d) is the sz of pointer, so depending on arch it will be 4 or 8 ... On Wed, Aug 31, 2011 at 11:57 AM, SANDEEP CHUGH sandeep.aa...@gmail.comwrote: its 4 3 i think On Wed, Aug 31, 2011 at 9:25 PM, aditi garg aditi.garg.6...@gmail.comwrote: 8 3 On Wed, Aug 31, 2011 at 9:22 PM, rohit raman.u...@gmail.com wrote: output?? int main() { char *d = abc\0def\0; printf(%d %d,sizeof(d),strlen(d)); getch(); } -- 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/msg/algogeeks/-/nf_M_Yoep_EJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New Delhi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output
sorry my mistake... it wud be 4 3 On Wed, Aug 31, 2011 at 9:30 PM, sachin goyal monugoya...@gmail.com wrote: 2 3 because d is pointer avriable On Wed, Aug 31, 2011 at 9:25 PM, aditi garg aditi.garg.6...@gmail.comwrote: 8 3 On Wed, Aug 31, 2011 at 9:22 PM, rohit raman.u...@gmail.com wrote: output?? int main() { char *d = abc\0def\0; printf(%d %d,sizeof(d),strlen(d)); getch(); } -- 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/msg/algogeeks/-/nf_M_Yoep_EJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New Delhi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New Delhi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output
8 3 is correct..winshuttle mein aaya tha ;) On Wed, Aug 31, 2011 at 9:30 PM, aditi garg aditi.garg.6...@gmail.comwrote: No sizeof ignores \0 On Wed, Aug 31, 2011 at 9:27 PM, SANDEEP CHUGH sandeep.aa...@gmail.comwrote: its 4 3 i think On Wed, Aug 31, 2011 at 9:25 PM, aditi garg aditi.garg.6...@gmail.comwrote: 8 3 On Wed, Aug 31, 2011 at 9:22 PM, rohit raman.u...@gmail.com wrote: output?? int main() { char *d = abc\0def\0; printf(%d %d,sizeof(d),strlen(d)); getch(); } -- 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/msg/algogeeks/-/nf_M_Yoep_EJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New Delhi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New Delhi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Dheeraj Sharma* Comp Engg. NIT Kurukshetra +91 8950264227 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output
yes it must be 4 3 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output
@dheeraj yea true,,,bt ut ws an array...its a pointer here...so output will be 4 3... infact it wud be 9 3 in the case u r considering On Wed, Aug 31, 2011 at 9:32 PM, Dheeraj Sharma dheerajsharma1...@gmail.com wrote: 8 3 is correct..winshuttle mein aaya tha ;) On Wed, Aug 31, 2011 at 9:30 PM, aditi garg aditi.garg.6...@gmail.comwrote: No sizeof ignores \0 On Wed, Aug 31, 2011 at 9:27 PM, SANDEEP CHUGH sandeep.aa...@gmail.comwrote: its 4 3 i think On Wed, Aug 31, 2011 at 9:25 PM, aditi garg aditi.garg.6...@gmail.comwrote: 8 3 On Wed, Aug 31, 2011 at 9:22 PM, rohit raman.u...@gmail.com wrote: output?? int main() { char *d = abc\0def\0; printf(%d %d,sizeof(d),strlen(d)); getch(); } -- 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/msg/algogeeks/-/nf_M_Yoep_EJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New Delhi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New Delhi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Dheeraj Sharma* Comp Engg. NIT Kurukshetra +91 8950264227 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New Delhi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output
8 3 wud the answer if you use the following syntax int main() { char d[] = abc\0def\0; printf(%d %d,sizeof(d),strlen(d)); getch(); } as you are using char *d so sizeof will print only size of pointer variable On Wed, Aug 31, 2011 at 9:32 PM, Dheeraj Sharma dheerajsharma1...@gmail.com wrote: 8 3 is correct..winshuttle mein aaya tha ;) On Wed, Aug 31, 2011 at 9:30 PM, aditi garg aditi.garg.6...@gmail.comwrote: No sizeof ignores \0 On Wed, Aug 31, 2011 at 9:27 PM, SANDEEP CHUGH sandeep.aa...@gmail.comwrote: its 4 3 i think On Wed, Aug 31, 2011 at 9:25 PM, aditi garg aditi.garg.6...@gmail.comwrote: 8 3 On Wed, Aug 31, 2011 at 9:22 PM, rohit raman.u...@gmail.com wrote: output?? int main() { char *d = abc\0def\0; printf(%d %d,sizeof(d),strlen(d)); getch(); } -- 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/msg/algogeeks/-/nf_M_Yoep_EJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New Delhi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New Delhi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Dheeraj Sharma* Comp Engg. NIT Kurukshetra +91 8950264227 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output
+1 aditi On Wed, Aug 31, 2011 at 9:34 PM, aditi garg aditi.garg.6...@gmail.comwrote: @dheeraj yea true,,,bt ut ws an array...its a pointer here...so output will be 4 3... infact it wud be 9 3 in the case u r considering On Wed, Aug 31, 2011 at 9:32 PM, Dheeraj Sharma dheerajsharma1...@gmail.com wrote: 8 3 is correct..winshuttle mein aaya tha ;) On Wed, Aug 31, 2011 at 9:30 PM, aditi garg aditi.garg.6...@gmail.comwrote: No sizeof ignores \0 On Wed, Aug 31, 2011 at 9:27 PM, SANDEEP CHUGH sandeep.aa...@gmail.comwrote: its 4 3 i think On Wed, Aug 31, 2011 at 9:25 PM, aditi garg aditi.garg.6...@gmail.comwrote: 8 3 On Wed, Aug 31, 2011 at 9:22 PM, rohit raman.u...@gmail.com wrote: output?? int main() { char *d = abc\0def\0; printf(%d %d,sizeof(d),strlen(d)); getch(); } -- 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/msg/algogeeks/-/nf_M_Yoep_EJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New Delhi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New Delhi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Dheeraj Sharma* Comp Engg. NIT Kurukshetra +91 8950264227 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New Delhi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output
for this char *d = abc\ldef\l; the output is 4 8 not 4 9 \l treated as one character On Wed, Aug 31, 2011 at 9:34 PM, aditi garg aditi.garg.6...@gmail.comwrote: @dheeraj yea true,,,bt ut ws an array...its a pointer here...so output will be 4 3... infact it wud be 9 3 in the case u r considering On Wed, Aug 31, 2011 at 9:32 PM, Dheeraj Sharma dheerajsharma1...@gmail.com wrote: 8 3 is correct..winshuttle mein aaya tha ;) On Wed, Aug 31, 2011 at 9:30 PM, aditi garg aditi.garg.6...@gmail.comwrote: No sizeof ignores \0 On Wed, Aug 31, 2011 at 9:27 PM, SANDEEP CHUGH sandeep.aa...@gmail.comwrote: its 4 3 i think On Wed, Aug 31, 2011 at 9:25 PM, aditi garg aditi.garg.6...@gmail.comwrote: 8 3 On Wed, Aug 31, 2011 at 9:22 PM, rohit raman.u...@gmail.com wrote: output?? int main() { char *d = abc\0def\0; printf(%d %d,sizeof(d),strlen(d)); getch(); } -- 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/msg/algogeeks/-/nf_M_Yoep_EJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New Delhi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New Delhi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Dheeraj Sharma* Comp Engg. NIT Kurukshetra +91 8950264227 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New Delhi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Dheeraj Sharma* Comp Engg. NIT Kurukshetra +91 8950264227 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output
8 3 On Wed, Aug 31, 2011 at 9:22 PM, rohit raman.u...@gmail.com wrote: output?? int main() { char *d = abc\0def\0; printf(%d %d,sizeof(d),strlen(d)); getch(); } -- 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/msg/algogeeks/-/nf_M_Yoep_EJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New Delhi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output
Depends on the 32-bit or 64-bit... sizeof(d) - returns the 4 in case of 32-bit, 8 incase of 64-bit strlen(d) - 3 On Wed, Aug 31, 2011 at 9:32 PM, Dheeraj Sharma dheerajsharma1...@gmail.com wrote: 8 3 is correct..winshuttle mein aaya tha ;) On Wed, Aug 31, 2011 at 9:30 PM, aditi garg aditi.garg.6...@gmail.comwrote: No sizeof ignores \0 On Wed, Aug 31, 2011 at 9:27 PM, SANDEEP CHUGH sandeep.aa...@gmail.comwrote: its 4 3 i think On Wed, Aug 31, 2011 at 9:25 PM, aditi garg aditi.garg.6...@gmail.comwrote: 8 3 On Wed, Aug 31, 2011 at 9:22 PM, rohit raman.u...@gmail.com wrote: output?? int main() { char *d = abc\0def\0; printf(%d %d,sizeof(d),strlen(d)); getch(); } -- 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/msg/algogeeks/-/nf_M_Yoep_EJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New Delhi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New Delhi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Dheeraj Sharma* Comp Engg. NIT Kurukshetra +91 8950264227 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] C output
#includestdio.h #define max(a,b) (ab?a:b) int main() { int j=max(3+2,2+8); printf(%d,j); return 0; } why this program show output as 9 ? please help me -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output
its output is 10 On Tue, Aug 23, 2011 at 12:03 AM, rohit rajuljain...@gmail.com wrote: #includestdio.h #define max(a,b) (ab?a:b) int main() { int j=max(3+2,2+8); printf(%d,j); return 0; } why this program show output as 9 ? please help me -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- U.D.I.T Sent by Nokia OVI (c) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output
Yeah its o/p is 10 :) On Tue, Aug 23, 2011 at 12:45 AM, Deepak Garg deepakgarg...@gmail.comwrote: its output is 10 On Tue, Aug 23, 2011 at 12:03 AM, rohit rajuljain...@gmail.com wrote: #includestdio.h #define max(a,b) (ab?a:b) int main() { int j=max(3+2,2+8); printf(%d,j); return 0; } why this program show output as 9 ? please help me -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- U.D.I.T Sent by Nokia OVI (c) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- **Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output
output is 10 using gcc 4.5.2 Yanan Cao On Mon, Aug 22, 2011 at 2:18 PM, sagar pareek sagarpar...@gmail.com wrote: Yeah its o/p is 10 :) On Tue, Aug 23, 2011 at 12:45 AM, Deepak Garg deepakgarg...@gmail.comwrote: its output is 10 On Tue, Aug 23, 2011 at 12:03 AM, rohit rajuljain...@gmail.com wrote: #includestdio.h #define max(a,b) (ab?a:b) int main() { int j=max(3+2,2+8); printf(%d,j); return 0; } why this program show output as 9 ? please help me -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- U.D.I.T Sent by Nokia OVI (c) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- **Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output
10 as 3+22+8?3+2:2+8 510?5:10 ' + ' has more precedence then ?: as well as s o/p is 10.. correct me if i am wrong. On Tue, Aug 23, 2011 at 12:50 AM, gmagog...@gmail.com gmagog...@gmail.comwrote: output is 10 using gcc 4.5.2 Yanan Cao On Mon, Aug 22, 2011 at 2:18 PM, sagar pareek sagarpar...@gmail.comwrote: Yeah its o/p is 10 :) On Tue, Aug 23, 2011 at 12:45 AM, Deepak Garg deepakgarg...@gmail.comwrote: its output is 10 On Tue, Aug 23, 2011 at 12:03 AM, rohit rajuljain...@gmail.com wrote: #includestdio.h #define max(a,b) (ab?a:b) int main() { int j=max(3+2,2+8); printf(%d,j); return 0; } why this program show output as 9 ? please help me -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- U.D.I.T Sent by Nokia OVI (c) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- **Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output
its 10 On Tue, Aug 23, 2011 at 12:03 AM, rohit rajuljain...@gmail.com wrote: #includestdio.h #define max(a,b) (ab?a:b) int main() { int j=max(3+2,2+8); printf(%d,j); return 0; } why this program show output as 9 ? please help me -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] C output
#includestdio.hconst char *fun(); int main() { char *ptr = fun(); return 0; }const char *fun() { return Hello; } Why doesn't this code give error?? -- 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/msg/algogeeks/-/qeUTNwGNKfwJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output
This is becuase Hello is a constant string and constant strings get stored in *Data Area, not in stack for the function you called. *Thats why pointer to constant string will be returned and program will not produce any error. Sanjay Kumar B.Tech Final Year Department of Computer Engineering National Institute of Technology Kurukshetra Kurukshetra - 136119 Haryana, India On Tue, Aug 16, 2011 at 8:19 AM, rohit raman.u...@gmail.com wrote: #includestdio.hconst char *fun(); int main() { char *ptr = fun(); return 0; }const char *fun() { return Hello; } Why doesn't this code give error?? -- 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/msg/algogeeks/-/qeUTNwGNKfwJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C output
i think this must have produced a warning..conversion from const char * to char*... On Tue, Aug 16, 2011 at 8:52 PM, Sanjay Rajpal sanjay.raj...@live.inwrote: This is becuase Hello is a constant string and constant strings get stored in *Data Area, not in stack for the function you called. *Thats why pointer to constant string will be returned and program will not produce any error. Sanjay Kumar B.Tech Final Year Department of Computer Engineering National Institute of Technology Kurukshetra Kurukshetra - 136119 Haryana, India On Tue, Aug 16, 2011 at 8:19 AM, rohit raman.u...@gmail.com wrote: #includestdio.hconst char *fun(); int main() { char *ptr = fun(); return 0; }const char *fun() { return Hello; } Why doesn't this code give error?? -- 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/msg/algogeeks/-/qeUTNwGNKfwJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards Himanshu Kansal Msc Comp. sc. (University of Delhi) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] C Output
int main () { printf(%d,1+2+5); getch(); return 0; } what should it return and how..?? -- 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/msg/algogeeks/-/2H3Gg6hLEQ0J. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C Output
i got a warning in gcc and the output was garbage On Sun, Aug 14, 2011 at 11:44 AM, Brijesh Upadhyay brijeshupadhyay...@gmail.com wrote: int main () { printf(%d,1+2+5); getch(); return 0; } what should it return and how..?? -- 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/msg/algogeeks/-/2H3Gg6hLEQ0J. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C Output
5 will represent address of 5 in heap. so adding 3 to 5 increment tht address by 3 and print it on the screen On Sun, Aug 14, 2011 at 11:44 AM, Brijesh Upadhyay brijeshupadhyay...@gmail.com wrote: int main () { printf(%d,1+2+5); getch(); return 0; } what should it return and how..?? -- 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/msg/algogeeks/-/2H3Gg6hLEQ0J. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] C Output
I think the address of string 5 located will be added with 1 and 2... On Sun, Aug 14, 2011 at 11:44 AM, Brijesh Upadhyay brijeshupadhyay...@gmail.com wrote: int main () { printf(%d,1+2+5); getch(); return 0; } what should it return and how..?? -- 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/msg/algogeeks/-/2H3Gg6hLEQ0J. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] c output doubt
int main() { int a[5]={1,2,3,4,5}; printf(%d,a[4]-a[0]) } why it show 4 not 16? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] c output doubt
Pointer incrementation and subtraction are done in terms of memory blocks and not addresses of memory. For example, int *p; p++; The pointer here jumps to the next integer location and not the next address in memory. Similarly,pointer subtraction will give the difference in indexes and not the memory addresses. If you try subtracting an integer pointer and a float pointer, it will be an error. On Fri, Aug 12, 2011 at 11:34 AM, rohit rajuljain...@gmail.com wrote: int main() { int a[5]={1,2,3,4,5}; printf(%d,a[4]-a[0]) } why it show 4 not 16? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] c output doubt
i didn't tried it .. but it might be internal conversion only , like whenever we do +1 to the address of int it automatically convert it into +4(i.e int size) On Fri, Aug 12, 2011 at 11:34 AM, rohit rajuljain...@gmail.com wrote: int main() { int a[5]={1,2,3,4,5}; printf(%d,a[4]-a[0]) } why it show 4 not 16? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Varun Jakhoria ...it's only about 0's 1's -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] c output doubt
4*(sizeof(int *)) Thank you, Siddharam On Fri, Aug 12, 2011 at 11:56 AM, Varun Jakhoria varunjakho...@gmail.comwrote: i didn't tried it .. but it might be internal conversion only , like whenever we do +1 to the address of int it automatically convert it into +4(i.e int size) On Fri, Aug 12, 2011 at 11:34 AM, rohit rajuljain...@gmail.com wrote: int main() { int a[5]={1,2,3,4,5}; printf(%d,a[4]-a[0]) } why it show 4 not 16? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Varun Jakhoria ...it's only about 0's 1's -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] c output doubt
On Fri, Aug 12, 2011 at 11:55 AM, Avinash Dharan avinashdha...@gmail.comwrote: Pointer incrementation and subtraction are done in terms of memory blocks and not addresses of memory. For example, int *p; p++; The pointer here jumps to the next integer location and not the next address in memory. Similarly,pointer subtraction will give the difference in indexes and not the memory addresses. If you try subtracting an integer pointer and a float pointer, it will be an error. On Fri, Aug 12, 2011 at 11:34 AM, rohit rajuljain...@gmail.com wrote: int main() { int a[5]={1,2,3,4,5}; printf(%d,a[4]-a[0]) } why it show 4 not 16? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] c output
main() { int m,n; m=3+max(2,3); n=2*max(3,2); printf(“%d,%d”,m,n); } ans:-m=2,n=3 why output is this??? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.