473,698 Members | 2,025 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

reply the answer

Can we write a C programe with out a semicolon ? printing HELLOWORLD !

Jun 24 '07
105 3228
On Sun, 24 Jun 2007 15:12:13 +0000, in comp.lang.c , Richard
Heathfield <rj*@see.sig.in validwrote:
>Harald van D?k said:
>Richard Heathfield wrote:
>>Eric Sosman said:
guthena wrote:
Can we write a C programe with out a semicolon ? printing
HELLOWORL D !

Yes.

I'm curious. I can see the print part easily enough, but how are you
going to handle the return statement? (Email reply welcome if you
don't want to spoil the OP's fun.)

There is no need for a return statement.

Oh. *That* kind of program. Count me out.
Whats wrong with a programme that conforms to the standard?

--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
Jun 24 '07 #11
On Sun, 24 Jun 2007 17:21:00 +0000, in comp.lang.c , Richard
Heathfield <rj*@see.sig.in validwrote:
>Harald van D?k said:
>Richard Heathfield wrote:
>>Harald van D?k said:

<snip>
>>>There is no need for a return statement.

Oh. *That* kind of program. Count me out.

I'm not sure what you mean by "that" kind. You don't need a return
statement in a strictly conforming C90 program that prints
"HELLOWORLD " and exits successfully.

Correction: *you* might not need a return statement there, but if I
can't have one there, I'm taking my ball home.
Fine, but its not our problem if some posters refuse to accept
standards-conforming code.
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
Jun 24 '07 #12
Richard Heathfield wrote:
Eric Sosman said:
>guthena wrote:
>>Can we write a C programe with out a semicolon ? printing HELLOWORLD
!
Yes.

I'm curious. I can see the print part easily enough, but how are you
going to handle the return statement? (Email reply welcome if you don't
want to spoil the OP's fun.)
Here's a program that doesn't fulfill the requirements,
but that outputs a hint about one way to satisfy them:

/* hint.c
* Compile in whatever way your system demands,
* then execute with the command-line arguments
* firstname lastname wants a hint
* substituting your own first and last names
* for `firstname' and `lastname'.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(int argv, char **argc)
{
if (argv != strlen("guthena " + 1)
|| strcmp(argc[3], "wants")
|| strcmp("hint", argc[5])
|| *argc[4]++-*++argc[3]
|| *argc[4]) {
fputs ("No hints for people who can't "
"follow simple directions!\n", stderr);
return EXIT_FAILURE;
}
printf ("This hint is for the sole use of %s ", *++argc);
printf ("%s: %d.", *++argc, argv--);
printf ("%.1f\n", argv * 21 / 10.0);
return EXIT_SUCCESS;
}

--
Eric Sosman
es*****@acm-dot-org.invalid


--
Eric Sosman
es*****@acm-dot-org.invalid
Jun 24 '07 #13
Richard Heathfield <rj*@see.sig.in validwrites:
sravan_reddy001 said:
>void main()
{
if(printf("Hell o World")){}
}

this is the simple way.

Alas, it doesn't conform to the specification, which called for a C
program.
I'd say that a "conforming program", as defined by C99 4p7, qualifies
as a C program. I believe the above is a conforming program.

(The real problem is that the standard's definition of "conforming
program" is nearly useless.)

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jun 24 '07 #14
Richard Heathfield wrote:
Eric Sosman said:
>guthena wrote:
>>Can we write a C programe with out a semicolon ? printing
HELLOWORLD !

Yes.

I'm curious. I can see the print part easily enough, but how are
you going to handle the return statement? (Email reply welcome if
you don't want to spoil the OP's fun.)
Use C99.

--
<http://www.cs.auckland .ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfoc us.com/columnists/423>
<http://www.aaxnet.com/editor/edit043.html>
cbfalconer at maineline dot net

--
Posted via a free Usenet account from http://www.teranews.com

Jun 25 '07 #15
sravan_reddy001 wrote:
>
void main()
{
if(printf("Hell o World")){}
}

this is the simple way. and even u can assign the values without using
semi-colon. if() is the best to use among
Not fully portable. Requires a #include statement, a type for
main, and C99.

--
<http://www.cs.auckland .ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfoc us.com/columnists/423>
<http://www.aaxnet.com/editor/edit043.html>
cbfalconer at maineline dot net

--
Posted via a free Usenet account from http://www.teranews.com

Jun 25 '07 #16
Keith Thompson said:
Richard Heathfield <rj*@see.sig.in validwrites:
>sravan_reddy00 1 said:
>>void main()
{
if(printf("Hell o World")){}
}

this is the simple way.

Alas, it doesn't conform to the specification, which called for a C
program.

I'd say that a "conforming program", as defined by C99 4p7, qualifies
as a C program.
I wouldn't say that. The definition is too loose to be useful. It
effectively means that any bug and any abuse is okay so long as the
compiler can be persuade to bumble its way through the code and produce
an executable.
I believe the above is a conforming program.
So are Fortran programs, apparently. I don't find this to be
particularly useful in deciding what are, and what are not, C programs.
(The real problem is that the standard's definition of "conforming
program" is nearly useless.)
Yes. I tend to think of "C program" as "program that is accepted by a
conforming newsgroup". :-)

--
Richard Heathfield <http://www.cpax.org.uk >
Email: -www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jun 25 '07 #17
CBFalconer said:
Richard Heathfield wrote:
>Eric Sosman said:
>>guthena wrote:

Can we write a C programe with out a semicolon ? printing
HELLOWORLD !

Yes.

I'm curious. I can see the print part easily enough, but how are
you going to handle the return statement? (Email reply welcome if
you don't want to spoil the OP's fun.)

Use C99.
I don't have the patience to wait that long. Nor do I have the
inclination to use ugly features just because they're legal.

--
Richard Heathfield <http://www.cpax.org.uk >
Email: -www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jun 25 '07 #18
On Mon, 25 Jun 2007 03:47:41 +0000, Richard Heathfield
<rj*@see.sig.in validwrote:
>CBFalconer said:
>Richard Heathfield wrote:
>>Eric Sosman said:
guthena wrote:

Can we write a C programe with out a semicolon ? printing
HELLOWORL D !

Yes.

I'm curious. I can see the print part easily enough, but how are
you going to handle the return statement? (Email reply welcome if
you don't want to spoil the OP's fun.)

Use C99.

I don't have the patience to wait that long. Nor do I have the
inclination to use ugly features just because they're legal.
So what you're saying is that C1999--I mean C99--was totally useless
(at least in this instance) in your point of view? If so, I tend to
agree.

Windows Vista, and even Windows XP, has a "Rollback driver" option. Is
there anything similar with respect to ISO/ANSI standards in general,
and the ISO/ANSI C99 standard in specific?

I'd be willing to bet that most regulars in this newsgroup wouldn't
hesitate to click on a button labeled "Rollback Standard Version" when
it comes to C.

--
jay
Jun 26 '07 #19
jaysome said:
On Mon, 25 Jun 2007 03:47:41 +0000, Richard Heathfield wrote:
>>CBFalconer said:
<snip>
>>Use C99.

I don't have the patience to wait that long. Nor do I have the
inclination to use ugly features just because they're legal.

So what you're saying is that C1999--I mean C99--was totally useless
(at least in this instance) in your point of view? If so, I tend to
agree.
Certainly in this instance, yes. The absence of a return statement from
main makes the program very, very marginally easier to write, at the
expense of being very marginally harder to read. The cost is N * delta
(where N is the number of times the code will be read), and the saving
is a mere 1 * epsilon. The game is not worth the candle.
Windows Vista, and even Windows XP, has a "Rollback driver" option. Is
there anything similar with respect to ISO/ANSI standards in general,
and the ISO/ANSI C99 standard in specific?
Not as far as I'm aware, at least not officially. In practice, that's
what implementors have actually done, for the most part.
I'd be willing to bet that most regulars in this newsgroup wouldn't
hesitate to click on a button labeled "Rollback Standard Version" when
it comes to C.
Here's what I'd have liked C99 to be:

X removal of K&R-style function definitions
X removal of gets
X removal of unadorned %s from *scanf
X #ifntypedef (but at least I understand why I can't have it)
X function without return statement not permitted except where return
type is void
X no changes may invade the user's identifier namespace
X no new headers
X operators for integer power and powmod
X (limited) support for operator overloading :-) perhaps as some kind of
preprocessor step:
e.g. #overload +(bignum b1, bignum2) bignum_add(&b1, &b2)
X a C equivalent of STL - that is, a standard set of routines for
manipulating dynamic strings, arrays, maps, and so on
* removal of implicit int
* compound literals
* support for complex types
* %zu for size_t in printf
* variable argument macros
* trailing comma allowed in enum
* snprintf and vsnprintf
* inline functions
* return without expression not permitted in function that returns a
value (and vice versa)

....and NOTHING ELSE.

Some of these changes are trivial, of course. Others are rather more
wide-ranging, but those are also the ones that I think would have been
most useful to most people. If the effort that had gone into codifying
97,000 pages of mostly useless mathematical features had instead gone
into some of these features, I think we'd have a more dynamic, vibrant
language - and one which implementors just *might* have taken the
trouble to implement.

--
Richard Heathfield <http://www.cpax.org.uk >
Email: -www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jun 26 '07 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1657
by: Showcar | last post by:
Thank you for your interest in the Hendrick Motorsports Showcar Program. In an attempt to answer your questions more effectively and efficiently, we have developed this automatic response. If this reply does not satisfactorily answer your questions, we will gladly respond to you personally as soon as possible. · If you would like more information on how to book a showcar appearance, please provide us with as much information as possible,...
1
1201
by: sorCrer | last post by:
Hi Juan, Thanks for the reply! Unfortunately your answer didn't help me. If I don't 'Import' the custom class then I can't call any of it's functions. This problem goes away if I compile the .vb file first, and import the namespace and class with an import directive! It's almost as if the framework can't see the /code directory the way it should.
4
1206
by: K.N.Ranjit | last post by:
Hi to all friends out there.I am presently working in TCS and I am supposed to do the work given to me in line cordinates using VB.net.But over here I face a problem (ie) I want my coordinate (0,0) to start in the lower-left corner of my form instead of the default upper-left corner of the form.If anyone could provide me the solution I would be very contended. I could do the same in VB by just changing that scale top property which would...
19
1698
by: wcfinvader | last post by:
I have known this girl forever every since 3rd grade we are both in 10th grade now and I feel like I am in love with her and I want to ask her out but I dont know if I should call her tonight or this weekend or if I should wait until Monday at school to ask her. (We dont have school Friday Parent techer confernce). I know she likes me but not sure if she loves me. in 6th grade she asked me to go out with her and I didnt at the time...
23
2017
by: novice | last post by:
I dint find a proper group to post this, so i'm asking this question. If you think this question is irrelevent then dont answer, but i expect good replies from experts. I wondor, how these guys who answer to complicated questions have mastered C. I'm a beginner in C, and wondor how to master C. Should i study theory, or start writing programs? If i should start writing programs, What programs should i start with?
3
5408
by: Frank | last post by:
I am attempting to develop a solution where I handle bounced e-mails. I wish to field all bounced emails in a custom email account such a bounced@mycompany.com From the aricle at http://www.systemwebmail.com/faq/2.7.aspx, I gather I could use: mail.Headers.Add( "Reply-To", "alternate_email@mycompany.com" ); When I test this from a test web app, I don't seem to field a bounced email
0
1192
by: roberto | last post by:
Sorry, but posting a reply does no work (6 hours after the "successful" post the message is not shown)) so I decided to post it. This is a reply to a thread http://groups.google.pl/group/microsoft.public.dotnet.framework.webservices/browse_thread/thread/1de13b5ef20c837a/78006eaa8e840fd1#78006eaa8e840fd1 Web Service API is a minimal one, there is nothing to refactor. What I want is to hide complexities of the proxy from third-party...
1
1667
by: Karon Davis | last post by:
Hi, can someone tell me if it's possible to send delivery status notifications (or NDRs) to the Reply-To address (specified in CDOSYS script) rather than the FROM address? thanks.
0
8598
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9152
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9014
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8885
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8855
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6515
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4358
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4612
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3037
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.