-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
madhukar_bm wrote:
b_*********@hot mail.com (Prashanth Badabagni) wrote in message
news:<d1******* *************** ****@posting.go ogle.com>...Hi,
Can any body tell me how to print "hello,worl d" with out using semicolon
Thanks in advance ..
Bye
Prashanth Badabagni
#include<stdio. h>
Whilst this line, of itself, does not contain a semicolon, it's actions
effectively insert many other lines (some of which /may/ contain semicolons)
into the source code. This is line technically satisfies the OPs requirement,
but operationally may not.
void main()
In a hosted implementation, main() returns int, and must be declared so, unless
an implementation-specific extension is in use. No such extension has been
mentioned, and the OPs question does not specify an unhosted implementation, so
this line is suspect.
{
if(printf("hell o world\n"))
An if() statement requires the inclusion of at least one additional statement,
to be executed when the if() evaluates to true. Your code above is a syntax
error at the very least.
Also, main() returns int. Ensure that int is returned. }
Alternatively, given a C99-compliant compiler for a hosted environment...
int main(void)
{
if (printf("hello, world\n")) {}
}
/*
** In the absence of a prototype, the printf() function is
** assumed to return int and to take as its argument
** a single string. Both of these assumptions are consistant
** with the function declaration found in stdio.h, and thus
** while fragile and technically suspect, is acceptable.
** The absence of the stdio include eliminates the possibility
** of included semicolons, and satisfies the argument against
** the use of an included header in /this/ program.
**
** The if() statement is satisfied by an empty compound statement,
** correcting the previous poster's syntax error.
**
** Finally, as the main() function is defined as returning int, and
** this is specified to be compiled in a C99-compliant compiler for
** a hosted environment, the language environment will ensure that
** an appropriate int value is returned from main() in the absence
** of an explicit value return.
*/
- --
Lew Pitcher
IT Consultant, Enterprise Application Architecture,
Enterprise Technology Solutions, TD Bank Financial Group
(Opinions expressed are my own, not my employers')
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
iD8DBQFAljs6agV FX4UWr64RAhvyAK CqIs5ZG0a3SOnnz jBhIyVtXgcgqACe PvBS
mcMg7GKVMllpnd7 ezuwi+g4=
=8u1d
-----END PGP SIGNATURE-----