Welcome, Guest. Please login or register.

Author Topic: Beginners 'C' programing group  (Read 13083 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline iamaboringperson

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 5744
    • Show all replies
Re: Beginners 'C' programing group
« on: February 12, 2004, 09:47:46 PM »
Cool idea.

Why is it in the 'basic' area?
 

Offline iamaboringperson

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 5744
    • Show all replies
Re: Beginners 'C' programing group
« Reply #1 on: February 12, 2004, 10:15:08 PM »
A little test!

Which of the following is C ?


10 PRINT "HELLO";

printf("Hello, world!");

cout << "Hello, world!" ;
 

Offline iamaboringperson

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 5744
    • Show all replies
Re: Beginners 'C' programing group
« Reply #2 on: February 12, 2004, 10:32:47 PM »
I'm sure this would be good for other platforms too.
 

Offline iamaboringperson

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 5744
    • Show all replies
Re: Beginners 'C' programing group
« Reply #3 on: February 12, 2004, 11:07:26 PM »
what happened to (int argc, char *argv[] ) ?
 

Offline iamaboringperson

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 5744
    • Show all replies
Re: Beginners 'C' programing group
« Reply #4 on: February 12, 2004, 11:14:20 PM »
Quote
To remain compatible, a lot of implementations still allow the original old definition.
(Just to confuse things) Like this: ?

void main(argc,argv)
int argc;
char **argv;
{
...
}

er... if that's how it's done, it's been such a long time since I've programmed that way...


I could be wrong
 

Offline iamaboringperson

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 5744
    • Show all replies
Re: Beginners 'C' programing group
« Reply #5 on: February 12, 2004, 11:23:41 PM »
:lol:
 

Offline iamaboringperson

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 5744
    • Show all replies
Re: Beginners 'C' programing group
« Reply #6 on: February 12, 2004, 11:28:48 PM »
Quote

Karlos wrote:
I havent had to define main in any of my C++ projects for over a year now..

I bet Patrik knows what I mean ;-)
Could mean anything...


You've been working on the same projects for over a year? :lol:
 

Offline iamaboringperson

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 5744
    • Show all replies
Re: Beginners 'C' programing group
« Reply #7 on: February 12, 2004, 11:37:41 PM »
Quote
Laugh it up mate, laugh it up.
:roflmao:
 

Offline iamaboringperson

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 5744
    • Show all replies
Re: Beginners 'C' programing group
« Reply #8 on: February 13, 2004, 12:30:40 AM »
Nah, it would be best to stick with C, and cover the exact same things as in the ARKRM's & NDK, etc...

Stick to standard stuff.


MUI wouldn't be too bad later on also

 

Offline iamaboringperson

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 5744
    • Show all replies
Re: Beginners 'C' programing group
« Reply #9 on: February 13, 2004, 12:42:45 AM »
BASIC is a waste of time

C is the best because most of the same code can be used under AmigaOS, MorphOS, and AROS, and you can actually program some decent games and utilities with it.

You don't need objects, streams, classes, templates, vectors etc. for good software for Amiga!


Pluss if you want to learn the standard and normal way to program on Amiga, then Intuition, GadTools, and BOOPSI all use plain C.

 

Offline iamaboringperson

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 5744
    • Show all replies
Re: Beginners 'C' programing group
« Reply #10 on: February 13, 2004, 01:35:01 AM »
Quote
May I suggest you not take this group private? Do it right here on A-Org,
I agree. I don't see why people want to take this elsewhere...
 

Offline iamaboringperson

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 5744
    • Show all replies
Re: Beginners 'C' programing group
« Reply #11 on: February 14, 2004, 06:05:52 AM »
May I make a suggestion?

Perhaps all of the best tips, tutorials, and other lessons etc. could be compiled into one archive. Perhaps an AmigaGuide document could be made out of it.

This could be the ultimate reference and tutorial that could replace the RKRM's and NDK.
 

Offline iamaboringperson

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 5744
    • Show all replies
Re: Beginners 'C' programing group
« Reply #12 on: February 15, 2004, 04:22:44 AM »
Quote
I don't think I'll ever like C. It looks like something created for a parser that was written in one night instead intended as a quality language. One can have a great language without the visual ugliness of C. Or it's counterintuitive use of grammar and math characters. It's just the most goddamn impossible language tp read through that I've ever seen.
For a programming language, C is actually quite sexy. You'll notice this once you become familliar with it.

Quote
As far as I'm concerned, either use Assembler, or use AMOS or Blitz. Anything inbetween is kind of pointless.
Inbetween? BASIC is pointless!

C is structured, and perfect for large projects that need standardization and portability.

In short C is the most practiable of them all! (C++ also)

Quote
Having said that, I guess I'd like to revisit C since so much $&^@ documentation assumes you're comfortable with it. Bastards. This is what happens when wannabe's outnumber true coders in colleges.
It has a reletively steap learning curve. That's all it is.

Quote
Still, why waste time with C when C++ exists?
If you don't like C for the reasons you explained above, you'll probably hate the idea of C++

C is probably better to learn for Amiga programmers.

It's also easier to learn.
 

Offline iamaboringperson

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 5744
    • Show all replies
Re: Beginners 'C' programing group
« Reply #13 on: February 15, 2004, 04:37:35 AM »
Re: Pointers in C


People do find pointers tricky, and I guess that could be due to the fact that people don't really understand what they are.


Not that I reccomend going out and learning assembler just to under stand them, but I knew assembler before I started learning C, so I knew about addressing already.

Some of the code looked a little funny (ampersands and asterisks infront of variable names), and when I realised that a 'pointer' was actually just an address of a particular variable or structure, it became so much easier.


I think it's important to learn how functions are entered and exited. And to learn about how the stack works, that may solve some peoples problematic programming - like what fluff 'pointed' out.


One problem I had when I started learning C, was understanding how functions worked. I could define them etc.  however I treated function calls like 'gosub' or 'goto' in basic.

What I would sometimes do, is if I wanted to 'goto' the top of the function, I would just thisveryfunc() there!! Of course a program doing that will easily run out of stack space after a while! (yeah.. recursion...)

Recursion I think is a fairly advanced subject, the only use for it that comes into mind at the moment (although there are many more) is traversing binary trees etc.


People who are used to Basic and Assembler need to get used to the idea of local variables, too :)

 

Offline iamaboringperson

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 5744
    • Show all replies
Re: Beginners 'C' programing group
« Reply #14 on: February 15, 2004, 12:44:13 PM »
Quote
Since I studied chemisrty, I learned 680x0/PPC asm, C, C++ and Java entirely in my own time. I also started with a knowledge of BASIC and can assure anybody that moving to C from such a background is far from impossible.
Which remindes me that in one course I took, we had to program in C for a couple of the digital electronics modules. (Interfacing with hardware we assembled)

C is not just a language that 'programmers' who are employed to only program use. It's probably used in many other professions also. I could imagine that electronics engineers these days probably couldn't get very far without a little programming experience.

And C is probably the best language for scientific use.