Re: C and C++




"Logan Shaw" <lshaw-usenet@xxxxxxxxxxxxx> wrote in message
news:46830f9f$0$8003$4c368faf@xxxxxxxxxxxxxxxxx
Bill Cunningham wrote:
I have been having trouble getting used to C. A very simple
language. Could this be because I was very familiar with C++ before
trying to learn C? The fstream header is so simple. using fopen, fread
and fwrite for example seems complicated.

There is an art to getting things done easily in C code. Writing concise
C code that isn't also cryptic and buggy is an even more difficult art.
But it can be done, to some extent.

A lot of it involves learning and developing idioms to accomplish tasks
in a certain standard way with a minimum of extra added steps.

For example, to see if argv contains the switches "-fast" or "-slow",
and to accumulate all the arguments that aren't switches into another
list, you might do something like this:

int main(int argc, char* argv[])
This is a legal invocation of main?
--
Wade Ward


.