[algogeeks] C output problem

2011-07-17 Thread aditi garg
#includestdio.h
#define FUN(arg) do\
   {\
  if(arg)\
printf(have fun...,\n);\
   } while(i--)
void main()
{int i=2;
FUN(i3);
}

A.have fun..
   have fun..
   have fun..
B.have fun..have fun..have fun..
C.Error : cannot use instructions in macro
D.No output

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 problem

2011-07-17 Thread Piyush Sinha
the output will be (b)
before looking for the reason, you should know the syntax of printf

*int printf(const char *format,)*

the function at the string after the comma operator only if the format
string aks for any format specifier like %d or %f etc...u can try it like
this also in normal main function

*printf(piyush,sinha);

*It wil compile and run successfully...and u can guess the output too :)
*
*
On Mon, Jul 18, 2011 at 2:19 AM, aditi garg aditi.garg.6...@gmail.comwrote:

 #includestdio.h
 #define FUN(arg) do\
   {\
  if(arg)\
printf(have fun...,\n);\
   } while(i--)
 void main()
 {int i=2;
 FUN(i3);
 }

 A.have fun..
   have fun..
   have fun..
 B.have fun..have fun..have fun..
 C.Error : cannot use instructions in macro
 D.No output

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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-7483122727*
* https://www.facebook.com/profile.php?id=10655377926 NEVER SAY
NEVER
*

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 problem

2011-07-17 Thread aditi garg
Thanks a lot :)

On Mon, Jul 18, 2011 at 2:48 AM, Piyush Sinha ecstasy.piy...@gmail.comwrote:

 the output will be (b)
 before looking for the reason, you should know the syntax of printf

 *int printf(const char *format,)*

 the function at the string after the comma operator only if the format
 string aks for any format specifier like %d or %f etc...u can try it like
 this also in normal main function

 *printf(piyush,sinha);

 *It wil compile and run successfully...and u can guess the output too
 :)*
 *
 On Mon, Jul 18, 2011 at 2:19 AM, aditi garg aditi.garg.6...@gmail.comwrote:

 #includestdio.h
 #define FUN(arg) do\
   {\
  if(arg)\
printf(have fun...,\n);\
   } while(i--)
 void main()
 {int i=2;
 FUN(i3);
 }

 A.have fun..
   have fun..
   have fun..
 B.have fun..have fun..have fun..
 C.Error : cannot use instructions in macro
 D.No output

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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-7483122727*
 * https://www.facebook.com/profile.php?id=10655377926 NEVER SAY
 NEVER
 *

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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

9718388816

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.