On Wed, Jul 30, 2008 at 8:40 AM, kathir resh <[EMAIL PROTECTED]> wrote:
> #include<stdio.h>
>  #include<conio.h>
>  void main()

main() should return int, not float, void or struct foo.

>  {
>       int i;
>  i=main();
>  printf("%d",i);
>  }
>
>   instead of i=main() using i=printf("hai");
>  returns no of characters printed.why cant i get i to print wh the main() 
> returns..

1) as pointed out above, your main is returning void, so it makes no
sense to assign the return value to an int.
2) Your code never reaches the printf() statement since the line above
calls main() again before getting there. On each invocation.

> if not give the correct procedure

The 'correct' procedure is not to call main() from within your program
- it's at best bad style, and at worst (in C++) not allowed.

-- 
PJH

'Two Dead in Baghdad' not 'product-friendly' - Kent Ertugrul, chief
executive of Phorm.

http://shabbleland.myminicity.com

Reply via email to