@aditya . (int*)0 is pointing to Null value , so (int*)0+1 will be 0x4 which is the size of int as implemented in compiler . so basically your code is returning sizeof(int) which will always return 4 which is equivalent to 32 bits . I couldn't check this program on a 64 bit machine ( p.s. mine support 64 bit but the OS is 32 bit ) but I guess it will return 32 on 64 bit machine as well I may be wrong, so If you have run this code and found 64 than let me know.
On Thu, Aug 11, 2011 at 5:59 PM, aditya kumar <aditya.kumar130...@gmail.com> wrote: > printf("%d",((int)((int *)0 + 1))*8); > o/p :: 32/64 > On Thu, Aug 11, 2011 at 5:14 PM, sukran dhawan <sukrandha...@gmail.com> > wrote: >> >> thanks >> >> On Thu, Aug 11, 2011 at 5:02 PM, Aditya Virmani <virmanisadi...@gmail.com> >> wrote: >>> >>> u can never find tht thru ur prgm...sizeof int is compiler dependant >>> whether its 32/64 bit... >>> >>> On Thu, Aug 11, 2011 at 4:35 PM, sukran dhawan <sukrandha...@gmail.com> >>> wrote: >>>> >>>> how to determine whether the machine is a 32 bit or 64 bit using a c >>>> program? >>>> is it by sizeof(int) * 4? >>>> >>>> -- >>>> 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. > -- Rohit Jangid Under Graduate Student, Deptt. of Computer Engineering NSIT, Delhi University, India -- 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.