Setting up tinycc C compiler

How to do things, solutions, recipes, tutorials
Post Reply
Message
Author
User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

Setting up tinycc C compiler

#1 Post by Lobster »

This page (C gurus please check and add to)

http://www.goosee.com/puppy/wikka/TinyCc

will get you started in the interpreted mode of tinycc
which Barry has adopted (Adopt-a-Puppy)

I was trying to work out how to do a random function
but never did . . .
still it is a start . . .

"Hello World"

menno

random

#2 Post by menno »

Code: Select all

int main() {
int i;
/* init random generator by current time */
srand(time(0));
/* so now display ten random numbers */
for (i=0;i<10;i++){
    printf("%d is %g\n",i,rand()); 
    }
return 0;
}
Save this as randtest.c .

execute by tcc -run randtest.c
or
compile it as tcc -o randtcc randtest.c
and run it by ./randtcc

Every time you run it you get a other sequence of ten numbers .

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

Random Sea

#3 Post by Lobster »

Thanks Menno :)

that will do nicely . . .

the numbers seem to be in
what I believe are referred to as floating point
Tried to find a mod or modulus function
- in fact tried to find a C tutorial and I must 'av
been looking in the wrong caves - coz I found nothing
entiled "C for cructaceans and dumb aquatics"

tinycc - a c compiler and interpreter is too kewl

. . . now it takes two years to learn to program in C
(according to all the best mermaid tales)
If my psychiatrist approves and I can afford the
performance enhancing drugs and mineral supplements
I may go for it.

NB. Only Puppy can do this . . .

Who else is coming? (so to speak)

8)
Last edited by Lobster on Sat 04 Jun 2005, 19:11, edited 1 time in total.


User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

Just right

#5 Post by Lobster »

Thanks Menno

That will do nicely . . .
I will put the link in tuxcards (part of puppy)
which is ideal for snippets of code
- bits of C weed

:)
Appreciate it - many thanks

Post Reply