Login
Username:

Password:

Remember me



Lost Password?

Register now!
Main Menu
Who's Online
1 user(s) are online (1 user(s) are browsing Forum)

Members: 0
Guests: 1

more...

Browsing this Thread:   1 Anonymous Users



« 1 (2)


Re: Let`s learn how to code in C!

Joined:
2010/12/23 9:12
Group:
Member
Posts: 67
Offline
The most important thing to know about programming in C is:
Comments are written like /* this */,
Most compilers will also accept them like: // this.

Even if you happen to learn the whole of the language from bad examples, getting into the habit of commenting NOW, will still get you through. If you learn from a good book, but don't comment, just like people forget the details of the language, you'll still forget how your program works.

Speaking of a good book:
- The C Programming Language" - Kernighan, Ritchie can be bought from the Internet for some 12 euros.
- The C Programming Language, 2nd edition" - Kernighan, Ritchie can be bought from the Internet for some 20 euros.
The first one for if you really can't spare more money, but take the second one if you can, as it covers the ANSI version of C. The book is both a tutorial and a reference manual, it'll teach you the language if you have no other teacher, and afterwards it'll let you look up the details you forget.


/* C. Amiga Micro Add: A program to add two numbers. */

/* This version asks for two integers, adds them, and
* prints the result.
* There's a companion program that uses floats.
* NOTE: If both programs are kept, one needs to be renamed.
* BUG: If both numbers are entered at once,
* will still ask for second number.
* More of a weakness than a bug; change or leave it?
*/

/* ----------------------------------------------------- */

#include <stdio.h>

int main(void) {
int a; int b; int res; /* Probably could be compacted. */
/* Do the names of these explain their functions? */

/* Introduction */
printf("\n\nWelcome to Amiga Micro Add V.0.0.1\n\n");

/* Input conversation */
printf("\nPlease enter a Number for Addition : ");
scanf("%d",&a); /* Get first number. */
printf("\nPlease enter a second Number for Addition: ");
scanf("%d",&b); /* Get second number. */

/* Calculation */
res = a + b;

/* Output */
printf("\nThe result is: %d\n", res);


/* Feedback (none) */
return 0;
}

/* ----------------------------------------------------- */

/* Do we really need that many newlines?
** If we do, is there a reason why some are
** at the start of the line and others at the end?
* It now sums up two numbers; can we make it sum up more?
* As this is an Amiga program, check conventions for
* Amiga commands from the C: drawer.
*/


Bye

Posted on: 6/19 8:01
_________________
Mysha
Transfer the post to other applications Transfer


Re: Let`s learn how to code in C!

Joined:
2005/11/18 22:57
Group:
Member
Posts: 448
Offline
No need to spend much money. This is free for Online Reading and it is written for Beginners:

http://openbook.rheinwerk-verlag.de/c_von_a_bis_z/


Posted on: 6/21 1:50
Transfer the post to other applications Transfer


Re: Let`s learn how to code in C!

Joined:
2009/3/15 4:41
Group:
Member
Posts: 625
Offline
C is just a language.

The other parts are the libraries, without them you can't even write the "Hello World" program.

The libraries might confuse a former BASIC programmer. But most programming languages have only a limited set of I/O functions. If you want windows, buttons, text boxes, graphics or sound you will need libraries for it.

You can decide between OS oriented libraries (great for application programming on Amiga, AROS, Morphos) or cross platform libraries like SDL (great for games on Amiga, AROS, Morphos, Linux, Windows)

Posted on: 6/22 12:17
Transfer the post to other applications Transfer


Re: Let`s learn how to code in C!

Joined:
2010/10/7 15:30
Group:
Member
Posts: 701
Offline
What do you all think would be list of pre-requisites for being an Aros Programmer?

Posted on: 6/24 15:02
_________________
http://www.hollywood-mal.com/
Transfer the post to other applications Transfer


Re: Let`s learn how to code in C!

Joined:
5/29 10:12
From England
Group:
Member
Posts: 63
Offline
Are we talking about someone that wants to write a piece of software that runs on Aros, or someone that wants to help develop Aros itself?

Two very different things.

Also, even if the answer is "write a piece of software that runs on Aros" the pre-requisites are going to be pretty wide and varied without answering the next question which is going to be...

What do you want to develop? (Game, command line tool, etc.)

Posted on: 6/24 16:16
Transfer the post to other applications Transfer


Re: Let`s learn how to code in C!

Joined:
2010/10/7 15:30
Group:
Member
Posts: 701
Offline
Thanks for a cool reply.
I guess making applications would be best before doing OS development.


Posted on: 6/24 19:49
_________________
http://www.hollywood-mal.com/
Transfer the post to other applications Transfer


Re: Let`s learn how to code in C!

Joined:
2005/11/18 22:57
Group:
Member
Posts: 448
Offline
Quote:

trekiej wrote:
Thanks for a cool reply.
I guess making applications would be best before doing OS development.




Then I think, starting with plain C an Zune is the way to go.
http://www.aros.org/documentation/dev ... plication-development.php

Posted on: 6/25 4:50
Transfer the post to other applications Transfer


Re: Let`s learn how to code in C!

Joined:
2010/10/7 15:30
Group:
Member
Posts: 701
Offline
To make a list:
We have C, Zune GUI, OpenGL, Library, and Driver.
The last 3 could be learned, I guess, in any order.

Posted on: 6/25 6:52
_________________
http://www.hollywood-mal.com/
Transfer the post to other applications Transfer



« 1 (2)



You can view topic.
You cannot start a new topic.
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.

[Advanced Search]


Search
Top Posters
1 paolone
paolone
4433
2 magorium
magorium
4095
3 nikolaos
nikolaos
4018
4 phoenixkonsole
phoenixkonsole
3928
5 deadwood
deadwood
2917
6 ncafferkey
ncafferkey
2796
7 mazze
mazze
2221
8 clusteruk
clusteruk
2112
9 damocles
damocles
1789
10 BSzili
BSzili
1513
© 2004-2018 AROS Exec