Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Advice - Where to start?

Status
Not open for further replies.

tcloud

MIS
Jul 20, 2001
18
0
0
US
I'm seeking recommendations on the most practical and expedient path to start learning C, for someone with no programming experience.


Thanks

 
What do you plan to do with your C programming?
There are many areas where C is not the best
language for development when a particular focus
is the goal.


 
That's a very good question, but one I'm not really sure how to answer.

I've been wanting to learn a programming language, and as I've been surveying the available choices, I keep coming back to C.

I don't really have a particular "thing" I want to accomplish at this time, other than getting started with learning how to program. I guess at this point, it's about personal growth, rather than ideas of professional advancement. Probably sounds naive...

I am a network administrator, with a predominant focus on Novell products. I'm also currently learning Linux.
 
Well with (Novell & Linux) , you still get a thumbs
up from me and probably a binary positive as well ;)

Seriously. C is difficult. It is relatively portable,
but not as portable as most interpreted languages with
support for the target platform. C requires an idea
of how things are done at a relatively low level.

Allocation of memory, design(including (platform specific:
thread safety,abstractions and API's, SYS V IPC, and
assorted other problems confront every C programmer.

My experience with novell says that they went java
a long time ago for user space apps. Maybe you should
check that out first?
 
Yeah, they do use Java for a lot of apps. I'll take that into consideration.

Thanks
 
Well if you have no programming experience, I'd suggest you don't start with C, for the reasons marsd states. C has lots of bear traps for the unwary, which are made even worse by the fact they don't always go off the first time you step on them.

Have a look at python as a relatively simple interpreted language for practicing on.

An analogy: The car you use to drive to work is not the same as the car you used to learn to drive.
C is very much a language of getting stuff done.

> I am a network administrator,
So are you looking to programming to help automate your life by doing some of the repetetive work for you?

--
 
If I can become decent enough in any language, I would hope to use it as an aid to my repetetive work tasks.

I think that I considered C first and again, because of the desire to also learn Linux (and Unix). It seems that a knowledge of C would be good in working with those systems.
 
> It seems that a knowledge of C would be good in working with those systems.
Yes if you're writing new kernel modules say, but I can think of better things to use for running sequences of programs, and performing data extraction for reports say.

For automating tasks, you need a scripting language. All scripting languages treat strings as primitive data types, but in C, you have to do a lot for yourself.

So what might take a few seconds to put together in a scripting language can easy take hours/days if you have to roll everything yourself.

--
 
Wow, you guys are sending me right back to: Which language should I learn first? Thought I'd finally settled that problem.<g>

It's all good, though. I really appreciate the time you're all taking to help me understand.
 
Well I'm confused now.

Initially, you said "it's about personal growth, rather than ideas of professional advancement"
Then you said "I would hope to use it as an aid to my repetetive work tasks"

Now whilst you CAN use C to do all those automation type tasks, you're in for a long haul before you would become anything like effective at solving those kinds of problems. If you're looking for any kind of early payback, then you're simply going to get disappointed and give up completely.

Trivial example - sum the file sizes in a directory.

C answer
Code:
#include <stdio.h>
#include <string.h>
int main ( ) {
  char buff[BUFSIZ];
  int sum = 0;
  while ( fgets ( buff, BUFSIZ, stdin ) ) {
    int thissize;
    if ( sscanf( buff, "%*s%*s%*s%*s%d", &thissize ) == 1 ) {
      sum += thissize;
    }
  }
  printf("%d\n", sum );
  return 0;
}

You then have to compile that code.
[tt]$ gcc -W -Wall -ansi -pedantic prog.c[/tt]

And then invoke it.
[tt]$ ls -l | ./a.out
9415487
[/tt]

In AWK (just one of several capable scripting languages), its just a few characters typed in on the command line.
Code:
$ ls -l | awk '{ sum += $5 }
END { print sum }'
9415487

Now scale that up to a fairly complicated script, and you're looking at massive amounts of C to write (and debug).

Like I said, if it's "just for the fun of it", then go for it. Just don't believe you'll be able to leverage it for work any time soon.

As a final point, I'd just like to say that learning to program is not the same as learning a programming language.
I mean, once you know how to program, a lot of languages start to look pretty similar.

--
 
Sorry Salem, I didn't mean to sound contradictory.

This *is* for personal growth. However, if I found myself becoming proficient enough, I would doubtless start using what I learned in my work environment - if the language I learn is appropriate/useful for those tasks.

Really though, I doubt I'll gain enough proficiency in any language to be able to do that any time soon. Primarily, this is for me.

Now, as a beginner, I guess my main goal is "learning to program". With that, considering the hurdles involved with starting in C, I'm coming to understand that I should start with either Java or Python instead.

I hope I'm not starting to talk in circles. I really appreciate the time you're giving me with this.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top