[algogeeks] output C

2012-02-25 Thread Ravi Ranjan
#include stdio.h
#include stdlib.h

#define SIZEOF(arr) (sizeof(arr)/sizeof(arr[0]))

  #define PrintInt(expr) printf(%s:%d\n,#expr,(expr))

int main(int argc, char *argv[])
{

  /* The powers of 10 */
  int pot[] = {
  0001,
  0010,
  0100,
  1000
  };
  int i;

  for(i=0;iSIZEOF(pot);i++)
   PrintInt(pot[i]);

  system(PAUSE);
  return 0;
}


howz dat output come 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] output C

2012-02-25 Thread atul anand
 0001,
 0010,
 0100,
these number are represented in octal ..so u r getting decimal of the same.
1000 - this is a decimal value;

preceding number by 0 means you are representing it in octal format

similarly preceding 0x means representing in hexa format.

On Sun, Feb 26, 2012 at 3:38 AM, Ravi Ranjan ravi.cool2...@gmail.comwrote:

 #include stdio.h
 #include stdlib.h

 #define SIZEOF(arr) (sizeof(arr)/sizeof(arr[0]))

   #define PrintInt(expr) printf(%s:%d\n,#expr,(expr))

 int main(int argc, char *argv[])
 {

   /* The powers of 10 */
   int pot[] = {
   0001,
   0010,
   0100,
   1000
   };
   int i;

   for(i=0;iSIZEOF(pot);i++)
PrintInt(pot[i]);

   system(PAUSE);
   return 0;
 }


 howz dat output come 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.