473,890 Members | 1,373 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

(Info) Test Your C Programming Strengths

Hi Friends

Click here : www.c4swimmers.esmartguy.com to Test Your C Programming
Strengths.
You can find Tricky Questions on C, Interview type queries on C,
Infrequently Answered Questions in C and many more...

Thank You

Regards
Kishor
Nov 14 '05
34 15045
> >>>> Doesnt' that site needs to be updated. They seem to still be using void main().
Ah, yes, "void main()" which was part of standard C way back NEVER.
I have often wondered where not only newbies, but book authors, got the
idea that void main() was any form of C at all.

Oh, c'mon...it doesn't take a great deal of imagination to see how
void main()
would have made a lot of sense at the time:

1. Using just
main()
defaults to returning int (of course, nowadays it should be made
explicit). What if you wanted to make sure everyone knew you were
_not_ returning an int, or anything else? There was no way to do it
before the void keyword was borrowed from C++, so it seemed like a
relief to finally have a way to express that when void was added to
the language.


This does not answer the question. *WHY* would you want to make sure
everyone knew you were not returning an int? *WHY* would you not want
to return an int in the first place?


It's common practice (and recommended style by many) to make
functions not return a value, if the purpose of the function
does not include returning an informative value.

If one fails to understand C program startup, it's natural
to extend this practice to main().

Compounding the problem was the facts:
- most noobs use dos/windows
- the most common dos/windows noob compiler was Borland
- Borland allowed "void main()" and even included examples of it (IIRC)
Nov 14 '05 #31
Old Wolf <ol*****@inspir e.net.nz> scribbled the following:
> Click here : (url removed) to Test Your C Programming Hm, let me try a few of those printf questions:

[Q001] - Undefined behavior, since main() must return an int.
[Q002] - Undefined behavior, since main() must return an int.
[Q003] - Undefined behavior, since main() must return an int.
[Q004] - Undefined behavior, since main() must return an int.
[Q005] - Undefined behavior, since main() must return an int.
[Q006] - Undefined behavior, since main() must return an int.

Oh well, this is getting boring. Back to work.

I've heard that the program behaviour is still defined in this case,
but its exit status is undefined (ie. the program will still do
what it is meant to do (barring any other errors!) , at least up until
after its point of termination.


You've heard wrong. The ISO C standard allows a program which defines
main() as void to do *anything it bloody well wants to*, and still be
within the bounds of legal behaviour.

--
/-- Joona Palaste (pa*****@cc.hel sinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"You can pick your friends, you can pick your nose, but you can't pick your
relatives."
- MAD Magazine
Nov 14 '05 #32
Old Wolf <ol*****@inspir e.net.nz> scribbled the following:
>>>> Doesnt' that site needs to be updated. They seem to still be using void main().
>>> Ah, yes, "void main()" which was part of standard C way back NEVER.
>>I have often wondered where not only newbies, but book authors, got the
>>idea that void main() was any form of C at all.
> Oh, c'mon...it doesn't take a great deal of imagination to see how
> void main()
> would have made a lot of sense at the time:
> 1. Using just
> main()
> defaults to returning int (of course, nowadays it should be made
> explicit). What if you wanted to make sure everyone knew you were
> _not_ returning an int, or anything else? There was no way to do it
> before the void keyword was borrowed from C++, so it seemed like a
> relief to finally have a way to express that when void was added to
> the language.


This does not answer the question. *WHY* would you want to make sure
everyone knew you were not returning an int? *WHY* would you not want
to return an int in the first place?

It's common practice (and recommended style by many) to make
functions not return a value, if the purpose of the function
does not include returning an informative value. If one fails to understand C program startup, it's natural
to extend this practice to main(). Compounding the problem was the facts:
- most noobs use dos/windows
- the most common dos/windows noob compiler was Borland
- Borland allowed "void main()" and even included examples of it (IIRC)


So... where did Borland get it from? Someone must have originally
invented it.

--
/-- Joona Palaste (pa*****@cc.hel sinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
Nov 14 '05 #33
Keith Thompson wrote:
Richard Bos wrote:
What is this, a test on how many errors you can find on the site?
Sorry, I gave up after I ran out of fingers.


I'm not surprised that there were that many errors; I'm just
surprised that you had the patience to find 1024 of them.


Obviously he used base 1, not base 2.

Nov 14 '05 #34
na***********@r ediffmail.com (Kishor) wrote in message news:<84******* *************** ***@posting.goo gle.com>...
Hi Friends

Click here : www.c4swimmers.esmartguy.com to Test Your C Programming
Strengths.
You can find Tricky Questions on C, Interview type queries on C,
Infrequently Answered Questions in C and many more...


Great effort. I really appreciate your hard work; you might have
sacrificed a lot to produce such a great site. I wish your site should
evolve more with lot of free and good stuffs.

By the way, you must understand the fact that C is about 30 years
old and most of the people present in this group are well experienced
C programmers/experts; few of them are even well renowned book
authors. You might have read the FAQ of this group
<http://groups.google.c om/groups?selm=200 4Feb01.0600.scs .0001%40eskimo. com>
So, you may consider using "humble" tone in old newsgroups like this.
(Don't mistaken me. Just my thoughts...)

All the best! Keep up your good work!

--
"Success = 10% sweat + 90% tears"
http://guideme.itgo.com/atozofc/ - "A to Z of C" Project
Email: rrjanbiah-at-Y!com
Nov 14 '05 #35

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

Similar topics

34
3219
by: Pmb | last post by:
Hi. I'm new to this group. I'm refreshing/learning C++ and am starting to learn Object Oriented Programming (OOP). In discussing this with people I came up short as to what the benefits of OOP are. For example: As I understand it, OOP has its main benefit in software reuse. Thus one develops a software library of classes and this cuts down the overhead of reinventing the wheel. Someone might say that this can be done with structured...
134
8103
by: evolnet.regular | last post by:
I've been utilising C for lots of small and a few medium-sized personal projects over the course of the past decade, and I've realised lately just how little progress it's made since then. I've increasingly been using scripting languages (especially Python and Bourne shell) which offer the same speed and yet are far more simple and safe to use. I can no longer understand why anyone would willingly use C to program anything but the lowest...
3
2008
by: Siddharth Jain | last post by:
Hello, Could someone please tell me the history of GUI programming for windows. In the early days, we had to write 100s of lines of code to make a simple dialog box. Then along came MFC to simplify things. And now, finally we have visual C#.NET. Is that right? Is there anything else to it? Can someone please guide me to some link form where I can get to know how things evolved from pre-MFC to MFC to where we are now.
458
21664
by: wellstone9912 | last post by:
Java programmers seem to always be whining about how confusing and overly complex C++ appears to them. I would like to introduce an explanation for this. Is it possible that Java programmers simply aren't smart enough to understand C++? This is not merely a whimsical hypothesis. Given my experience with Java programmers --- the code they write and the conversations they have --- Occam's Razor points to this explanation. For example,...
7
1411
by: David Levine | last post by:
Hello, I want to get information on unit test and related (e.g. mock object) products available for managed code. What products are available and what do you think about them? Which are the best, which do you recommend, strengths and weaknesses, etc. For example, how does NUnit compare to Team System's unit test? TIA
47
5979
by: Thierry Chappuis | last post by:
Hi, I'm interested in techniques used to program in an object-oriented way using the C ANSI language. I'm studying the GObject library and Laurent Deniau's OOPC framework published on his web site at http://ldeniau.web.cern.ch/ldeniau/html/oopc/oopc.html. The approach is very instructive. I know that I could do much of this stuff with e.g. C++, but the intellectual challenge of implementing these concepts with pure ANSI C is relevant to...
3
1263
by: Paul | last post by:
Looking for recommendations on a programming language for a web application. I am soliciting recommendations on a programming language for a web application described below. Actually, it is not real, just an example of what the real application would do. I do not want to stimulate any debates between respondents. Everyone is entitled to their opinion. Let me be the one to privately decide on the validity of the comments. All options...
176
8543
by: nw | last post by:
Hi, I previously asked for suggestions on teaching testing in C++. Based on some of the replies I received I decided that best way to proceed would be to teach the students how they might write their own unit test framework, and then in a lab session see if I can get them to write their own. To give them an example I've created the following UTF class (with a simple test program following). I would welcome and suggestions on how anybody...
0
1015
by: Reedick, Andrew | last post by:
<snip> I have a Perl background and have found the O'Reilly books to be useful. The Learning Python book (or whatever it's called) is good because it covers the paradigm shifts and potential gotchas that you won't even consider thinking about otherwise. Only downside is wading through the novice 'how to program' parts. The Cookbook is also good for getting 'standard' apps up and running quickly (meaning you know how to do it in Perl,...
0
9980
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
10830
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
10925
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
10468
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...
0
5855
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
6061
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4682
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
2
4276
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3283
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.