Wanting to Learn

T

Tim Apple

Hello All,

I would like to learn C, I have 0 programming experience. If anyone has
links to good tutorials It would be appreciated, especially stuff that can
be downloaded. I am in the military and will be spending the next year in
Iraq. I will have my laptop with me and will use my free time to learn,
but I will have no net access. So whatever I can get on my hard drive to
bring with would be appreciated. Thanks

Sgt Tim Apple
US Army
 
R

Richard Bos

Tim Apple said:
I would like to learn C, I have 0 programming experience.

Warning: C can be full of traps for the absolute beginner, especially
without a proper teacher. It _is_ possible to learn to be a good
programmer starting with C, but trying to do so on your own is asking
for trouble, especially from a web tutorial - most aren't very good.

It's wiser, IMO, to learn to be a good programmer first, and then learn
C. C assumes that the programmer knows what he's doing. Learning to
program is easier using a language that assumes you don't know what
you're doing. I personally suggest Pascal, but other people will
recommend other languages, most of whom I haven't tried, so can't judge.

Richard
 
L

Leor Zolman

Hello All,

I would like to learn C, I have 0 programming experience. If anyone has
links to good tutorials It would be appreciated, especially stuff that can
be downloaded. I am in the military and will be spending the next year in
Iraq. I will have my laptop with me and will use my free time to learn,
but I will have no net access. So whatever I can get on my hard drive to
bring with would be appreciated. Thanks

Sgt Tim Apple
US Army

It's true that C and C++ aren't the best "first" programming
languages; you may be told by the compiler that you've done something
wrong, but you'll still have a lot of trouble knowing how to fix it.
(That's still true for me right now, actually, for template messages
in C++...)

If you do decide to tackle C, a couple of suggestions:

1), 2), 3), and 4) Find someone who already knows it that will let you
ask him/her questions. That's IMO by far the most important resource
you'll ever have.

5) Get a copy of K&R 2nd ed. , and then either "The C Answer Book"
(hard copy) or you can grab this site off the web (using, say,
TelePort Pro):
http://users.powernet.co.uk/eton/kandr2/

Do all the exercises yourself, then compare your solutions. If you
make it through all that, you'll know C pretty well ;-)
-leor


Leor Zolman
BD Software
(e-mail address removed)
www.bdsoft.com -- On-Site Training in C/C++, Java, Perl & Unix
C++ users: Download BD Software's free STL Error Message
Decryptor at www.bdsoft.com/tools/stlfilt.html
 
T

Tim Apple

Some of you are saying c is not the best language to start with pascal was
a recomendation, any others?

Sgt Tim Apple
 
G

gabriel

Tim said:
Some of you are saying c is not the best language to start with pascal
was a recomendation, any others?

Well, what do you want to do? I know a lot of military people who are
trying to figure out what to do afterwards, and they choose to get into
programming. Is this you?

There are a lot of things to consider, specially the type of programming
that you want to get into. If you would like to tinker with "system" stuff
like operating systems, very scientific algorithms, or you would like to
squeeze out every possible bit of performance out of the processor (and who
cares if it takes a year to write), then C is a great place to start.

If you would like to learn computer science in general, then I would start
out with C#, Java, or Delphi, but only because, as others said, starting in
C without a mentor nearby is suicide.

If you want to write GUI programs with the nice screens and friendly
interfaces, database access, and rapid development, then you would do
better to go to the anti-Christ (at least in this group) sort of
technologies (Microsoft Visual Basic, or .NET), or a more sensible choice
which is Delphi (Borland's Object-Oriented Pascal). The focus in these
kinds of languages is to let you put something out the door quicker,
looking nicer, and you did not spend a long time producing it. Also, when
writing with these kinds of languages and compilers, you concentrate more
on _what_ you are solving rather than _how_ you are solving it.
 
B

Bruno Desthuilliers

Tim said:
Some of you are saying c is not the best language to start with pascal was
a recomendation, any others?

Sgt Tim Apple

#include <evangelism/python.h>

Python is a simple but powerful (in term of what you can do, not of
execution speed !-) language that may be a good choice for absolute
beginners, since
- the syntax is clear and readable
- the language supports many paradigms (procedural - as C and Pascal-,
object - as C++ and Java and... -, functional - as Lisp, ML etc)
- it comes with an interpreter and a shell, so you can test code in
'real time'
- there are some Python tutorials for absolute beginners.

http://www.python.org

Well, it's quite a good replacement for grand dad's basic, and you can
also use it to write real, non trivial, working apps.

Now it won't learn you the low-level details of memory management and
the like...

My 2 cents
Bruno
 
S

Sidney Cadot

Tim said:
Some of you are saying c is not the best language to start with pascal was
a recomendation, any others?

Python was recommended as well. Perhaps the ideal learning path would
consist of a couple of months Python (which is an interpreted language
without strongly typed variables), followed by a transition to the much
stricter Pascal. This would give you a great deal of insight into the
relative strengths and weeknesses of both types of languages.

After mastering Pascal you will be ready to take on C. It has many more
'degrees of freedom', i.e. it is (somewhat) more powerful, but it is
also much harder to use properly.

For Pascal, I'd recommend you get your hands on Turbo Pascal 7, which is
very old, but it was /way/ ahead of its time. As a didactic device, I
think the environment (with the integrated debugger) cannot be beaten.

Turbo Pascal is a superset of Pascal by the way, meaning that you get
many (sensible!) extensions to plain (ISO) Pascal.


Have a good mission and a safe return.


Best regards,

Sidney
 
M

Morris Dovey

Tim said:
I would like to learn C, I have 0 programming experience.

Tim...

Then go for it! Everyone has to start somewhere. You'll need
access to a computer with a C compiler and some reading material.
Start by writing tiny, simple programs and work your way up to
larger, more complex, programs.

Feel free to make mistakes - you'll probably learn more from
those than from any other single source.

You've already found comp.lang.c - feel welcome to come here for
help with any C difficulties you might have.

My sig has a link to a page of links for beginners. Take time to
read about asking smart questions and the comp.lang.c welcome and
FAQ pages.

There's info there that'll help you download a free C compiler if
you don't have one available.
 
A

Ashish

Tim Apple said:
Hello All,

I would like to learn C, I have 0 programming experience. If anyone has
links to good tutorials It would be appreciated, especially stuff that can
be downloaded. I am in the military and will be spending the next year in
Iraq. I will have my laptop with me and will use my free time to learn,
but I will have no net access. So whatever I can get on my hard drive to
bring with would be appreciated. Thanks

Sgt Tim Apple
US Army

Tim, get a good C book with lots of examples, and a free (or non-free) C
compiler.
One book which I used many years ago, when I started learning C, was
'Mastering Turbo C' by Tenanbaum. It has lots of good examples. Others may
have better advices for books, though.

HTH
-Ashish
 
C

CBFalconer

Sidney said:
Python was recommended as well. Perhaps the ideal learning path would
consist of a couple of months Python (which is an interpreted language
without strongly typed variables), followed by a transition to the much
stricter Pascal. This would give you a great deal of insight into the
relative strengths and weeknesses of both types of languages.

After mastering Pascal you will be ready to take on C. It has many more
'degrees of freedom', i.e. it is (somewhat) more powerful, but it is
also much harder to use properly.

For Pascal, I'd recommend you get your hands on Turbo Pascal 7, which is
very old, but it was /way/ ahead of its time. As a didactic device, I
think the environment (with the integrated debugger) cannot be beaten.

Turbo Pascal is a superset of Pascal by the way, meaning that you get
many (sensible!) extensions to plain (ISO) Pascal.

In the interests of accuracy, TP is not a superset, it is a
subset, with many extensions. It has very serious omissions of
standard Pascal capabilities. The extensions introduce many
insecurities, but you don't have to use them. Unfortunately it
won't tell you what IS standard and what is extension.
 
B

Bruno Desthuilliers

Sidney said:
Python was recommended as well. Perhaps the ideal learning path would
consist of a couple of months Python (which is an interpreted language
without strongly typed variables),

<ot topic='python'>
Er... I would not start the Standard Holy War n°2 (tm) [1], but just a
correction : Python *is* strongly typed [2] - but dynamically. Which
means that the type is bound to the object, not to the id the object is
bound to.

[1] which is "dynamic vs static typing"
[2] You just can't add a string, an integer and a list together, this
would raise an exception.

</ot>

(snip the rest)

Bruno
 
S

Sidney Cadot

Bruno said:
Sidney said:
Python was recommended as well. Perhaps the ideal learning path would
consist of a couple of months Python (which is an interpreted language
without strongly typed variables),


<ot topic='python'>
Er... I would not start the Standard Holy War n°2 (tm) [1], but just a
correction : Python *is* strongly typed [2] - but dynamically. Which
means that the type is bound to the object, not to the id the object is
bound to.

[1] which is "dynamic vs static typing"
[2] You just can't add a string, an integer and a list together, this
would raise an exception.

</ot>

Your terminology is, indeed, less prone to confusion. However, it is
debatable what "strongly typed language" really means; personally, I
take it to be equivalent to what you call a "statically typed" language.

If someone else has a different idea, I'd love to hear it; I'd also like
to see examples of non-strongly-typed languages, for an alternative
definition.

Best regards,

Sidney
 
B

Bruno Desthuilliers

Sidney said:
Bruno said:
Sidney Cadot wrote:
(snip)
Python was recommended as well. Perhaps the ideal learning path would
consist of a couple of months Python (which is an interpreted
language without strongly typed variables),

<ot topic='python'>
Er... I would not start the Standard Holy War n°2 (tm) [1], but just a
correction : Python *is* strongly typed [2] - but dynamically. Which
means that the type is bound to the object, not to the id the object
is bound to.

[1] which is "dynamic vs static typing"
[2] You just can't add a string, an integer and a list together, this
would raise an exception.

</ot>

Your terminology is, indeed, less prone to confusion. However, it is
debatable what "strongly typed language" really means;

Indeed. The meaning of a whole lot of things is debatable.
What about : "a strongly typed language is a language that won't let you
add an integer and a string" ?-)
personally, I
take it to be equivalent to what you call a "statically typed" language.

And you're wrong - at least with the above definition.
If someone else has a different idea, I'd love to hear it;

You did !-)
I'd also like
to see examples of non-strongly-typed languages, for an alternative
definition.

<no-holy-war-please>

You've got one right here : the C programming language.

[laotseu@localhost fclc]$ cat add.c

int main(void)
{
int z;
char *y;
int a = 10;
char *b = "30";
a + b;
z = a + b;
y = a + b;
return 0;
}
[laotseu@localhost fclc]$ gcc -Wall -ansi -pedantic add.c
add.c: In function `main':
add.c:9: warning: assignment makes integer from pointer without a cast
add.c:8: warning: statement with no effect
[laotseu@localhost fclc]$


Well... As you can see, adding an integer and a char pointeur is not a
problem for gcc.


Now in python :

[laotseu@localhost fclc]$ python
Python 2.3.2 (#1, Oct 27 2003, 01:23:54)Traceback (most recent call last):

Now here you just *can't* add an integer and a string.

</no-holy-war-please>

Ok, I know, I gave a *really* debatable definition of "strongly typed",
and one that did fit my needs. Call me a cheater if you want (time to
put my bullet-proof jacket on, I think).

Bruno
 
D

Dik T. Winter

> Sidney Cadot wrote: ....
>
> Indeed. The meaning of a whole lot of things is debatable.
> What about : "a strongly typed language is a language that won't let you
> add an integer and a string" ?-)

Would make Algol 68 a weakly-typed language if you add the following
declaration:
'op'('int','string') + = (('int' i, 'string' s): i);
(Darn, I am forgetting the syntax, the above is probably not entirely
correct.)

But have a look at <http://c2.com/cgi/wiki?StronglyTyped>, I personally
prefer definition 8. Python does not satisfy quite a few of those 8
definitions.
 
J

Jason

Tim said:
Hello All,

I would like to learn C, I have 0 programming experience. If anyone has
links to good tutorials It would be appreciated, especially stuff that can
be downloaded. I am in the military and will be spending the next year in
Iraq. I will have my laptop with me and will use my free time to learn,
but I will have no net access. So whatever I can get on my hard drive to
bring with would be appreciated. Thanks

Sgt Tim Apple
US Army

Sgt. Apple,

In much appreciation of your willingness to serve in the armed forces to
protect the citizens (myself a citizen of this great nation) of this
nation, I am willing to send you a book from my personal library as a
small token of my appreciation.

The book is titled C How to Program 2nd edition and is written by
H.M.Deitel and P.J. Deitel. It is a paperback text with an ISBN number
of 0-13-226119-7 in case you want to look at it on amazon.com or another
book seller online.

This is the text I used when I took my first programming class and I
thought it was a pretty good book.

If you are interested, please write me at (e-mail address removed).

Thank you, Best Wishes, and God Speed.

Sincerely,

Jason Smith
 
S

Sidney Cadot

Dik said:
Would make Algol 68 a weakly-typed language if you add the following
declaration:
'op'('int','string') + = (('int' i, 'string' s): i);
(Darn, I am forgetting the syntax, the above is probably not entirely
correct.)

But have a look at <http://c2.com/cgi/wiki?StronglyTyped>, I personally
prefer definition 8. Python does not satisfy quite a few of those 8
definitions.

Nice page. It is strange to see that a term that is so often used seems
to lack a proper definition.

Anyway, an excuse for me using "strongly typed", originally, is that I
used it to refer to "variables", not the "language".

Best regards,

Sidney
 
J

Jeremy Yallop

Dik said:
But have a look at <http://c2.com/cgi/wiki?StronglyTyped>, I personally
prefer definition 8. Python does not satisfy quite a few of those 8
definitions.

Neither does C! C fails to satisfy at least the following:

4. A language is strongly typed if conversions between different
types are forbidden. If such conversions are allowed, it is
weakly typed.

5. A language is strongly typed if conversions between different
types must be indicated explicitly. If implicit conversions are
performed, it is weakly typed.

6. A language is strongly typed if there is no language-level way
to disable or evade the type system. If there are casts or
other type-evasive mechanisms, it is weakly typed.

8. A language is strongly typed if the type of its data objects is
fixed and does not vary over the lifetime of the object. If the
type of a datum can change, the language is weakly typed.

Is there /any/ language that forbids "conversions between different
types" unconditionally?

Jeremy.
 
R

Richard Bos

Jeremy Yallop said:
Neither does C! C fails to satisfy at least the following:

4. A language is strongly typed if conversions between different
types are forbidden. If such conversions are allowed, it is
weakly typed.

5. A language is strongly typed if conversions between different
types must be indicated explicitly. If implicit conversions are
performed, it is weakly typed.

_Every_ language must, inevitably, fail at least one of the above -
they're mutually exclusive. I think you're supposed to pick the one you
prefer, not take them all at once.

Richard
 
D

Dik T. Winter

>
> Neither does C! C fails to satisfy at least the following: ....
> 8. A language is strongly typed if the type of its data objects is
> fixed and does not vary over the lifetime of the object. If the
> type of a datum can change, the language is weakly typed.

In what way does C fail here?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top