@ 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 <[email protected]>wrote:

> 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 <[email protected]>wrote:
>
>> i mean how it working actually?
>>
>>
>> On Thu, Jun 23, 2011 at 8:06 PM, Anika Jain <[email protected]>wrote:
>>
>>> hey ya its working :) but whats the logic behind it??
>>>
>>>
>>> On Thu, Jun 23, 2011 at 7:52 PM, Piyush Sinha 
>>> <[email protected]>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 <[email protected]> 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
>>>> > <[email protected]>wrote:
>>>> >
>>>> >> 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 <[email protected]> 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 [email protected].
>>>> >> > To unsubscribe from this group, send email to
>>>> >> > [email protected].
>>>> >> > 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=100000655377926 *
>>>> >>
>>>> >> --
>>>> >> You received this message because you are subscribed to the Google
>>>> Groups
>>>> >> "Algorithm Geeks" group.
>>>> >> To post to this group, send email to [email protected].
>>>> >> To unsubscribe from this group, send email to
>>>> >> [email protected].
>>>> >> 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 [email protected].
>>>> > To unsubscribe from this group, send email to
>>>> > [email protected].
>>>> > 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=100000655377926 *
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Algorithm Geeks" group.
>>>> To post to this group, send email to [email protected].
>>>> To unsubscribe from this group, send email to
>>>> [email protected].
>>>> 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 [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> 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=100000655377926 *
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to