Re: [algogeeks] c doubt again

2011-06-23 Thread Piyush Sinha
An asterisk indicates that the data is to be retrieved from the use
but ignored, i.e. it is not stored in the corresponding
argument...hence the third value entered gets stored for b and for c
the output comes to garbage value

One beautiful application of such type of implementation is in finding
the sum of 2 variables without using + operator..:)

On 6/23/11, Anika Jain anika.jai...@gmail.com wrote:
 int main()
 {
int a,b, c;
scanf(%d%*d%d,a,b,c);
printf(%d %d %d,a,b,c);
 }

 output: 25 35 garbage

 how is it happening??

 --
 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.




-- 
*Piyush Sinha*
*IIIT, Allahabad*
*+91-8792136657*
*+91-7483122727*
*https://www.facebook.com/profile.php?id=10655377926 *

-- 
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 doubt again

2011-06-23 Thread Anika Jain
thanx .. can u explain me how this is used in finding sum of 2 vars without
using + ??


On Thu, Jun 23, 2011 at 7:20 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote:

 An asterisk indicates that the data is to be retrieved from the use
 but ignored, i.e. it is not stored in the corresponding
 argument...hence the third value entered gets stored for b and for c
 the output comes to garbage value

 One beautiful application of such type of implementation is in finding
 the sum of 2 variables without using + operator..:)

 On 6/23/11, Anika Jain anika.jai...@gmail.com wrote:
  int main()
  {
 int a,b, c;
 scanf(%d%*d%d,a,b,c);
 printf(%d %d %d,a,b,c);
  }
 
  output: 25 35 garbage
 
  how is it happening??
 
  --
  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.
 
 


 --
 *Piyush Sinha*
 *IIIT, Allahabad*
 *+91-8792136657*
 *+91-7483122727*
 *https://www.facebook.com/profile.php?id=10655377926 *

 --
 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 doubt again

2011-06-23 Thread Piyush Sinha
sorry by mistake i added it in scanf situation..
actually this type of specifier can be used with printf statement for
finding the sum...

look at the code below

main()
{
 int a=9;
 int b=3;
 printf(%d\n,printf(%*s%*s,a,,b,));
 system(pause);
}

On 6/23/11, Anika Jain anika.jai...@gmail.com wrote:
 thanx .. can u explain me how this is used in finding sum of 2 vars without
 using + ??


 On Thu, Jun 23, 2011 at 7:20 PM, Piyush Sinha
 ecstasy.piy...@gmail.comwrote:

 An asterisk indicates that the data is to be retrieved from the use
 but ignored, i.e. it is not stored in the corresponding
 argument...hence the third value entered gets stored for b and for c
 the output comes to garbage value

 One beautiful application of such type of implementation is in finding
 the sum of 2 variables without using + operator..:)

 On 6/23/11, Anika Jain anika.jai...@gmail.com wrote:
  int main()
  {
 int a,b, c;
 scanf(%d%*d%d,a,b,c);
 printf(%d %d %d,a,b,c);
  }
 
  output: 25 35 garbage
 
  how is it happening??
 
  --
  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.
 
 


 --
 *Piyush Sinha*
 *IIIT, Allahabad*
 *+91-8792136657*
 *+91-7483122727*
 *https://www.facebook.com/profile.php?id=10655377926 *

 --
 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.




-- 
*Piyush Sinha*
*IIIT, Allahabad*
*+91-8792136657*
*+91-7483122727*
*https://www.facebook.com/profile.php?id=10655377926 *

-- 
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 doubt again

2011-06-23 Thread harshit pahuja
@anika can u will please tell me the source of all dese questions,,

actually i am new to this all
nd getting to learn a lot..
thanks in anticipation

On Thu, Jun 23, 2011 at 7:52 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote:

 sorry by mistake i added it in scanf situation..
 actually this type of specifier can be used with printf statement for
 finding the sum...

 look at the code below

 main()
 {
 int a=9;
 int b=3;
 printf(%d\n,printf(%*s%*s,a,,b,));
 system(pause);
 }

 On 6/23/11, Anika Jain anika.jai...@gmail.com wrote:
  thanx .. can u explain me how this is used in finding sum of 2 vars
 without
  using + ??
 
 
  On Thu, Jun 23, 2011 at 7:20 PM, Piyush Sinha
  ecstasy.piy...@gmail.comwrote:
 
  An asterisk indicates that the data is to be retrieved from the use
  but ignored, i.e. it is not stored in the corresponding
  argument...hence the third value entered gets stored for b and for c
  the output comes to garbage value
 
  One beautiful application of such type of implementation is in finding
  the sum of 2 variables without using + operator..:)
 
  On 6/23/11, Anika Jain anika.jai...@gmail.com wrote:
   int main()
   {
  int a,b, c;
  scanf(%d%*d%d,a,b,c);
  printf(%d %d %d,a,b,c);
   }
  
   output: 25 35 garbage
  
   how is it happening??
  
   --
   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.
  
  
 
 
  --
  *Piyush Sinha*
  *IIIT, Allahabad*
  *+91-8792136657*
  *+91-7483122727*
  *https://www.facebook.com/profile.php?id=10655377926 *
 
  --
  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.
 
 


 --
 *Piyush Sinha*
 *IIIT, Allahabad*
 *+91-8792136657*
 *+91-7483122727*
 *https://www.facebook.com/profile.php?id=10655377926 *

 --
 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.




-- 
HARSHIT PAHUJA
M.N.N.I.T.
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 doubt again

2011-06-23 Thread Anika Jain
i mean how it working actually?

On Thu, Jun 23, 2011 at 8:06 PM, Anika Jain anika.jai...@gmail.com wrote:

 hey ya its working :) but whats the logic behind it??


 On Thu, Jun 23, 2011 at 7:52 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote:

 sorry by mistake i added it in scanf situation..
 actually this type of specifier can be used with printf statement for
 finding the sum...

 look at the code below

 main()
 {
 int a=9;
 int b=3;
 printf(%d\n,printf(%*s%*s,a,,b,));
 system(pause);
 }

 On 6/23/11, Anika Jain anika.jai...@gmail.com wrote:
  thanx .. can u explain me how this is used in finding sum of 2 vars
 without
  using + ??
 
 
  On Thu, Jun 23, 2011 at 7:20 PM, Piyush Sinha
  ecstasy.piy...@gmail.comwrote:
 
  An asterisk indicates that the data is to be retrieved from the use
  but ignored, i.e. it is not stored in the corresponding
  argument...hence the third value entered gets stored for b and for c
  the output comes to garbage value
 
  One beautiful application of such type of implementation is in finding
  the sum of 2 variables without using + operator..:)
 
  On 6/23/11, Anika Jain anika.jai...@gmail.com wrote:
   int main()
   {
  int a,b, c;
  scanf(%d%*d%d,a,b,c);
  printf(%d %d %d,a,b,c);
   }
  
   output: 25 35 garbage
  
   how is it happening??
  
   --
   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.
  
  
 
 
  --
  *Piyush Sinha*
  *IIIT, Allahabad*
  *+91-8792136657*
  *+91-7483122727*
  *https://www.facebook.com/profile.php?id=10655377926 *
 
  --
  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.
 
 


 --
 *Piyush Sinha*
 *IIIT, Allahabad*
 *+91-8792136657*
 *+91-7483122727*
 *https://www.facebook.com/profile.php?id=10655377926 *

 --
 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 doubt again

2011-06-23 Thread Piyush Sinha
there is no as such logic behind it..its just the format specifier...

u must be knowing printf returns the number of values it has printed(u can
check that)

now, in printf if u write like *printf(%7s,a), *it will create 7
columns for the output and print a in the last column and the returned value
of this printf will be 7..(u can check it)

now if u write *printf(%*s,7,a)* then u r giving additional information
of format specifier i.e 7..returned value of this printf is also 7.

Hence the above logic..hope I am able to clarify it...:)

On Thu, Jun 23, 2011 at 8:06 PM, Anika Jain anika.jai...@gmail.com wrote:

 i mean how it working actually?


 On Thu, Jun 23, 2011 at 8:06 PM, Anika Jain anika.jai...@gmail.comwrote:

 hey ya its working :) but whats the logic behind it??


 On Thu, Jun 23, 2011 at 7:52 PM, Piyush Sinha 
 ecstasy.piy...@gmail.comwrote:

 sorry by mistake i added it in scanf situation..
 actually this type of specifier can be used with printf statement for
 finding the sum...

 look at the code below

 main()
 {
 int a=9;
 int b=3;
 printf(%d\n,printf(%*s%*s,a,,b,));
 system(pause);
 }

 On 6/23/11, Anika Jain anika.jai...@gmail.com wrote:
  thanx .. can u explain me how this is used in finding sum of 2 vars
 without
  using + ??
 
 
  On Thu, Jun 23, 2011 at 7:20 PM, Piyush Sinha
  ecstasy.piy...@gmail.comwrote:
 
  An asterisk indicates that the data is to be retrieved from the use
  but ignored, i.e. it is not stored in the corresponding
  argument...hence the third value entered gets stored for b and for c
  the output comes to garbage value
 
  One beautiful application of such type of implementation is in finding
  the sum of 2 variables without using + operator..:)
 
  On 6/23/11, Anika Jain anika.jai...@gmail.com wrote:
   int main()
   {
  int a,b, c;
  scanf(%d%*d%d,a,b,c);
  printf(%d %d %d,a,b,c);
   }
  
   output: 25 35 garbage
  
   how is it happening??
  
   --
   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.
  
  
 
 
  --
  *Piyush Sinha*
  *IIIT, Allahabad*
  *+91-8792136657*
  *+91-7483122727*
  *https://www.facebook.com/profile.php?id=10655377926 *
 
  --
  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.
 
 


 --
 *Piyush Sinha*
 *IIIT, Allahabad*
 *+91-8792136657*
 *+91-7483122727*
 *https://www.facebook.com/profile.php?id=10655377926 *

 --
 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.




-- 
*Piyush Sinha*
*IIIT, Allahabad*
*+91-8792136657*
*+91-7483122727*
*https://www.facebook.com/profile.php?id=10655377926 *

-- 
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 doubt again

2011-06-23 Thread rajeev bharshetty
@ Piyush Could u provide the link to some source , because i am still
unclear about the above concept .

Regards
Rajeev N B



On Thu, Jun 23, 2011 at 8:32 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote:

 there is no as such logic behind it..its just the format specifier...

 u must be knowing printf returns the number of values it has printed(u can
 check that)

 now, in printf if u write like *printf(%7s,a), *it will create 7
 columns for the output and print a in the last column and the returned value
 of this printf will be 7..(u can check it)

 now if u write *printf(%*s,7,a)* then u r giving additional
 information of format specifier i.e 7..returned value of this printf is also
 7.

 Hence the above logic..hope I am able to clarify it...:)


 On Thu, Jun 23, 2011 at 8:06 PM, Anika Jain anika.jai...@gmail.comwrote:

 i mean how it working actually?


 On Thu, Jun 23, 2011 at 8:06 PM, Anika Jain anika.jai...@gmail.comwrote:

 hey ya its working :) but whats the logic behind it??


 On Thu, Jun 23, 2011 at 7:52 PM, Piyush Sinha 
 ecstasy.piy...@gmail.comwrote:

 sorry by mistake i added it in scanf situation..
 actually this type of specifier can be used with printf statement for
 finding the sum...

 look at the code below

 main()
 {
 int a=9;
 int b=3;
 printf(%d\n,printf(%*s%*s,a,,b,));
 system(pause);
 }

 On 6/23/11, Anika Jain anika.jai...@gmail.com wrote:
  thanx .. can u explain me how this is used in finding sum of 2 vars
 without
  using + ??
 
 
  On Thu, Jun 23, 2011 at 7:20 PM, Piyush Sinha
  ecstasy.piy...@gmail.comwrote:
 
  An asterisk indicates that the data is to be retrieved from the use
  but ignored, i.e. it is not stored in the corresponding
  argument...hence the third value entered gets stored for b and for c
  the output comes to garbage value
 
  One beautiful application of such type of implementation is in
 finding
  the sum of 2 variables without using + operator..:)
 
  On 6/23/11, Anika Jain anika.jai...@gmail.com wrote:
   int main()
   {
  int a,b, c;
  scanf(%d%*d%d,a,b,c);
  printf(%d %d %d,a,b,c);
   }
  
   output: 25 35 garbage
  
   how is it happening??
  
   --
   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.
  
  
 
 
  --
  *Piyush Sinha*
  *IIIT, Allahabad*
  *+91-8792136657*
  *+91-7483122727*
  *https://www.facebook.com/profile.php?id=10655377926 *
 
  --
  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.
 
 


 --
 *Piyush Sinha*
 *IIIT, Allahabad*
 *+91-8792136657*
 *+91-7483122727*
 *https://www.facebook.com/profile.php?id=10655377926 *

 --
 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.




 --
 *Piyush Sinha*
 *IIIT, Allahabad*
 *+91-8792136657*
 *+91-7483122727*
 *https://www.facebook.com/profile.php?id=10655377926 *

  --
 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 

Re: [algogeeks] c doubt again

2011-06-23 Thread harshit pahuja
@rajeev

http://www.cplusplus.com/reference/clibrary/cstdio/scanf/
http://www.cplusplus.com/reference/clibrary/cstdio/printf/

On Thu, Jun 23, 2011 at 9:39 PM, rajeev bharshetty rajeevr...@gmail.comwrote:

 @ Piyush Could u provide the link to some source , because i am still
 unclear about the above concept .

 Regards
 Rajeev N B




 On Thu, Jun 23, 2011 at 8:32 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote:

 there is no as such logic behind it..its just the format specifier...

 u must be knowing printf returns the number of values it has printed(u can
 check that)

 now, in printf if u write like *printf(%7s,a), *it will create 7
 columns for the output and print a in the last column and the returned value
 of this printf will be 7..(u can check it)

 now if u write *printf(%*s,7,a)* then u r giving additional
 information of format specifier i.e 7..returned value of this printf is also
 7.

 Hence the above logic..hope I am able to clarify it...:)


 On Thu, Jun 23, 2011 at 8:06 PM, Anika Jain anika.jai...@gmail.comwrote:

 i mean how it working actually?


 On Thu, Jun 23, 2011 at 8:06 PM, Anika Jain anika.jai...@gmail.comwrote:

 hey ya its working :) but whats the logic behind it??


 On Thu, Jun 23, 2011 at 7:52 PM, Piyush Sinha ecstasy.piy...@gmail.com
  wrote:

 sorry by mistake i added it in scanf situation..
 actually this type of specifier can be used with printf statement for
 finding the sum...

 look at the code below

 main()
 {
 int a=9;
 int b=3;
 printf(%d\n,printf(%*s%*s,a,,b,));
 system(pause);
 }

 On 6/23/11, Anika Jain anika.jai...@gmail.com wrote:
  thanx .. can u explain me how this is used in finding sum of 2 vars
 without
  using + ??
 
 
  On Thu, Jun 23, 2011 at 7:20 PM, Piyush Sinha
  ecstasy.piy...@gmail.comwrote:
 
  An asterisk indicates that the data is to be retrieved from the use
  but ignored, i.e. it is not stored in the corresponding
  argument...hence the third value entered gets stored for b and for c
  the output comes to garbage value
 
  One beautiful application of such type of implementation is in
 finding
  the sum of 2 variables without using + operator..:)
 
  On 6/23/11, Anika Jain anika.jai...@gmail.com wrote:
   int main()
   {
  int a,b, c;
  scanf(%d%*d%d,a,b,c);
  printf(%d %d %d,a,b,c);
   }
  
   output: 25 35 garbage
  
   how is it happening??
  
   --
   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.
  
  
 
 
  --
  *Piyush Sinha*
  *IIIT, Allahabad*
  *+91-8792136657*
  *+91-7483122727*
  *https://www.facebook.com/profile.php?id=10655377926 *
 
  --
  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.
 
 


 --
 *Piyush Sinha*
 *IIIT, Allahabad*
 *+91-8792136657*
 *+91-7483122727*
 *https://www.facebook.com/profile.php?id=10655377926 *

 --
 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.




 --
 *Piyush Sinha*
 *IIIT, Allahabad*
 *+91-8792136657*
 *+91-7483122727*
 *https://www.facebook.com/profile.php?id=10655377926 *

  --
 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 

Re: [algogeeks] c doubt again

2011-06-23 Thread Piyush Sinha
or u cud consult ANSI C by Balaguruswamy in chapter of Console I/Ps and O/Ps

On 6/23/11, harshit pahuja hpahuja.mn...@gmail.com wrote:
 @rajeev

 http://www.cplusplus.com/reference/clibrary/cstdio/scanf/
 http://www.cplusplus.com/reference/clibrary/cstdio/printf/

 On Thu, Jun 23, 2011 at 9:39 PM, rajeev bharshetty
 rajeevr...@gmail.comwrote:

 @ Piyush Could u provide the link to some source , because i am still
 unclear about the above concept .

 Regards
 Rajeev N B




 On Thu, Jun 23, 2011 at 8:32 PM, Piyush Sinha
 ecstasy.piy...@gmail.comwrote:

 there is no as such logic behind it..its just the format specifier...

 u must be knowing printf returns the number of values it has printed(u
 can
 check that)

 now, in printf if u write like *printf(%7s,a), *it will create 7
 columns for the output and print a in the last column and the returned
 value
 of this printf will be 7..(u can check it)

 now if u write *printf(%*s,7,a)* then u r giving additional
 information of format specifier i.e 7..returned value of this printf is
 also
 7.

 Hence the above logic..hope I am able to clarify it...:)


 On Thu, Jun 23, 2011 at 8:06 PM, Anika Jain
 anika.jai...@gmail.comwrote:

 i mean how it working actually?


 On Thu, Jun 23, 2011 at 8:06 PM, Anika Jain
 anika.jai...@gmail.comwrote:

 hey ya its working :) but whats the logic behind it??


 On Thu, Jun 23, 2011 at 7:52 PM, Piyush Sinha ecstasy.piy...@gmail.com
  wrote:

 sorry by mistake i added it in scanf situation..
 actually this type of specifier can be used with printf statement for
 finding the sum...

 look at the code below

 main()
 {
 int a=9;
 int b=3;
 printf(%d\n,printf(%*s%*s,a,,b,));
 system(pause);
 }

 On 6/23/11, Anika Jain anika.jai...@gmail.com wrote:
  thanx .. can u explain me how this is used in finding sum of 2 vars
 without
  using + ??
 
 
  On Thu, Jun 23, 2011 at 7:20 PM, Piyush Sinha
  ecstasy.piy...@gmail.comwrote:
 
  An asterisk indicates that the data is to be retrieved from the use
  but ignored, i.e. it is not stored in the corresponding
  argument...hence the third value entered gets stored for b and for
  c
  the output comes to garbage value
 
  One beautiful application of such type of implementation is in
 finding
  the sum of 2 variables without using + operator..:)
 
  On 6/23/11, Anika Jain anika.jai...@gmail.com wrote:
   int main()
   {
  int a,b, c;
  scanf(%d%*d%d,a,b,c);
  printf(%d %d %d,a,b,c);
   }
  
   output: 25 35 garbage
  
   how is it happening??
  
   --
   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.
  
  
 
 
  --
  *Piyush Sinha*
  *IIIT, Allahabad*
  *+91-8792136657*
  *+91-7483122727*
  *https://www.facebook.com/profile.php?id=10655377926 *
 
  --
  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.
 
 


 --
 *Piyush Sinha*
 *IIIT, Allahabad*
 *+91-8792136657*
 *+91-7483122727*
 *https://www.facebook.com/profile.php?id=10655377926 *

 --
 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.




 --
 *Piyush Sinha*
 *IIIT, Allahabad*
 *+91-8792136657*
 *+91-7483122727*
 *https://www.facebook.com/profile.php?id=10655377926 *

  --
 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
 

Re: [algogeeks] c doubt again

2011-06-23 Thread Anika Jain
@ harshit: i find such questions from books like let us c, test ur c, dennis
ritchie and from test papers of companies that visit campus

On Thu, Jun 23, 2011 at 9:15 AM, Piyush Sinha ecstasy.piy...@gmail.comwrote:

 or u cud consult ANSI C by Balaguruswamy in chapter of Console I/Ps and
 O/Ps

 On 6/23/11, harshit pahuja hpahuja.mn...@gmail.com wrote:
  @rajeev
 
  http://www.cplusplus.com/reference/clibrary/cstdio/scanf/
  http://www.cplusplus.com/reference/clibrary/cstdio/printf/
 
  On Thu, Jun 23, 2011 at 9:39 PM, rajeev bharshetty
  rajeevr...@gmail.comwrote:
 
  @ Piyush Could u provide the link to some source , because i am still
  unclear about the above concept .
 
  Regards
  Rajeev N B
 
 
 
 
  On Thu, Jun 23, 2011 at 8:32 PM, Piyush Sinha
  ecstasy.piy...@gmail.comwrote:
 
  there is no as such logic behind it..its just the format specifier...
 
  u must be knowing printf returns the number of values it has printed(u
  can
  check that)
 
  now, in printf if u write like *printf(%7s,a), *it will create 7
  columns for the output and print a in the last column and the returned
  value
  of this printf will be 7..(u can check it)
 
  now if u write *printf(%*s,7,a)* then u r giving additional
  information of format specifier i.e 7..returned value of this printf is
  also
  7.
 
  Hence the above logic..hope I am able to clarify it...:)
 
 
  On Thu, Jun 23, 2011 at 8:06 PM, Anika Jain
  anika.jai...@gmail.comwrote:
 
  i mean how it working actually?
 
 
  On Thu, Jun 23, 2011 at 8:06 PM, Anika Jain
  anika.jai...@gmail.comwrote:
 
  hey ya its working :) but whats the logic behind it??
 
 
  On Thu, Jun 23, 2011 at 7:52 PM, Piyush Sinha 
 ecstasy.piy...@gmail.com
   wrote:
 
  sorry by mistake i added it in scanf situation..
  actually this type of specifier can be used with printf statement
 for
  finding the sum...
 
  look at the code below
 
  main()
  {
  int a=9;
  int b=3;
  printf(%d\n,printf(%*s%*s,a,,b,));
  system(pause);
  }
 
  On 6/23/11, Anika Jain anika.jai...@gmail.com wrote:
   thanx .. can u explain me how this is used in finding sum of 2
 vars
  without
   using + ??
  
  
   On Thu, Jun 23, 2011 at 7:20 PM, Piyush Sinha
   ecstasy.piy...@gmail.comwrote:
  
   An asterisk indicates that the data is to be retrieved from the
 use
   but ignored, i.e. it is not stored in the corresponding
   argument...hence the third value entered gets stored for b and
 for
   c
   the output comes to garbage value
  
   One beautiful application of such type of implementation is in
  finding
   the sum of 2 variables without using + operator..:)
  
   On 6/23/11, Anika Jain anika.jai...@gmail.com wrote:
int main()
{
   int a,b, c;
   scanf(%d%*d%d,a,b,c);
   printf(%d %d %d,a,b,c);
}
   
output: 25 35 garbage
   
how is it happening??
   
--
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.
   
   
  
  
   --
   *Piyush Sinha*
   *IIIT, Allahabad*
   *+91-8792136657*
   *+91-7483122727*
   *https://www.facebook.com/profile.php?id=10655377926 *
  
   --
   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.
  
  
 
 
  --
  *Piyush Sinha*
  *IIIT, Allahabad*
  *+91-8792136657*
  *+91-7483122727*
  *https://www.facebook.com/profile.php?id=10655377926 *
 
  --
  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
  

Re: [algogeeks] c doubt again

2011-06-23 Thread harshit pahuja
@anika -thankx :)

On Thu, Jun 23, 2011 at 11:57 AM, Anika Jain anika.jai...@gmail.com wrote:

 @ harshit: i find such questions from books like let us c, test ur c,
 dennis ritchie and from test papers of companies that visit campus


 On Thu, Jun 23, 2011 at 9:15 AM, Piyush Sinha ecstasy.piy...@gmail.comwrote:

 or u cud consult ANSI C by Balaguruswamy in chapter of Console I/Ps and
 O/Ps

 On 6/23/11, harshit pahuja hpahuja.mn...@gmail.com wrote:
  @rajeev
 
  http://www.cplusplus.com/reference/clibrary/cstdio/scanf/
  http://www.cplusplus.com/reference/clibrary/cstdio/printf/
 
  On Thu, Jun 23, 2011 at 9:39 PM, rajeev bharshetty
  rajeevr...@gmail.comwrote:
 
  @ Piyush Could u provide the link to some source , because i am still
  unclear about the above concept .
 
  Regards
  Rajeev N B
 
 
 
 
  On Thu, Jun 23, 2011 at 8:32 PM, Piyush Sinha
  ecstasy.piy...@gmail.comwrote:
 
  there is no as such logic behind it..its just the format specifier...
 
  u must be knowing printf returns the number of values it has printed(u
  can
  check that)
 
  now, in printf if u write like *printf(%7s,a), *it will create 7
  columns for the output and print a in the last column and the returned
  value
  of this printf will be 7..(u can check it)
 
  now if u write *printf(%*s,7,a)* then u r giving additional
  information of format specifier i.e 7..returned value of this printf
 is
  also
  7.
 
  Hence the above logic..hope I am able to clarify it...:)
 
 
  On Thu, Jun 23, 2011 at 8:06 PM, Anika Jain
  anika.jai...@gmail.comwrote:
 
  i mean how it working actually?
 
 
  On Thu, Jun 23, 2011 at 8:06 PM, Anika Jain
  anika.jai...@gmail.comwrote:
 
  hey ya its working :) but whats the logic behind it??
 
 
  On Thu, Jun 23, 2011 at 7:52 PM, Piyush Sinha 
 ecstasy.piy...@gmail.com
   wrote:
 
  sorry by mistake i added it in scanf situation..
  actually this type of specifier can be used with printf statement
 for
  finding the sum...
 
  look at the code below
 
  main()
  {
  int a=9;
  int b=3;
  printf(%d\n,printf(%*s%*s,a,,b,));
  system(pause);
  }
 
  On 6/23/11, Anika Jain anika.jai...@gmail.com wrote:
   thanx .. can u explain me how this is used in finding sum of 2
 vars
  without
   using + ??
  
  
   On Thu, Jun 23, 2011 at 7:20 PM, Piyush Sinha
   ecstasy.piy...@gmail.comwrote:
  
   An asterisk indicates that the data is to be retrieved from the
 use
   but ignored, i.e. it is not stored in the corresponding
   argument...hence the third value entered gets stored for b and
 for
   c
   the output comes to garbage value
  
   One beautiful application of such type of implementation is in
  finding
   the sum of 2 variables without using + operator..:)
  
   On 6/23/11, Anika Jain anika.jai...@gmail.com wrote:
int main()
{
   int a,b, c;
   scanf(%d%*d%d,a,b,c);
   printf(%d %d %d,a,b,c);
}
   
output: 25 35 garbage
   
how is it happening??
   
--
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.
   
   
  
  
   --
   *Piyush Sinha*
   *IIIT, Allahabad*
   *+91-8792136657*
   *+91-7483122727*
   *https://www.facebook.com/profile.php?id=10655377926 *
  
   --
   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.
  
  
 
 
  --
  *Piyush Sinha*
  *IIIT, Allahabad*
  *+91-8792136657*
  *+91-7483122727*
  *https://www.facebook.com/profile.php?id=10655377926 *
 
  --
  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,