Mini Intro to C: Control Flow
Nov 12Not much of a tutorial but something i found interesting.
According to The C Programming Language (which I trust more then the bible) it says:
for (expr1; expr2; expr3){
statement
}
is the same thing as
expr1;
while (expr2) {
statement;
expr3;
}
Bet you new C programmers didn’t know that one. I know I didn’t. Enjoy. I’ll post more minis as I find them.
Intro to Mathematics Part 2: Understanding Numbers
Nov 09Lets start off with something simple. Working with numbers. Get us familiar with some terms and differences between number types.
1. Integers
integers are 1, 2, 3, 4, 1000, 2390 etc Also known as whole numbers.
Integers can also hold negative numbers defined as -n. so -3, -2, -5, -30010
Lets do some simple math with these new information.
1. a + b = b + a
2. -a * b = -ab
3. a(-b) = a – b
Relation to Programming? C or C++
int number = 1000
int can only be whole numbers
——————–
2. Factors and Primes
integers can be broken down into smaller integer called factoring.
Example: 3*5*2 = 30. 3, 5 and 2 are all factors of 30.
not all integers have factors. this is called prime. Example ’11′
3.
Intro to Mathematics Part 1: Introduction
Nov 09The More and More you program the the More you will notice how important Math is to your daily needs. Unfortunately I never liked Math in school and breezed through it doing as little as I could on the subject. Well now that I am in the work force, I am scared that due to my awful Math skills, it relates to my programming skills. I am here to share with you what I use each day that relates to Math to make you and I a better Programmer.
I am not exactly sure how well this will work out but i’ll do my best to share math and programming together to help others who may be like how I am.
Cheers.
How to: Compiling C in Linux
Mar 15Learning the programming language C can be difficult, compiling it shouldn’t.
In linux we use GCC command in terminal for compiling.
GCC is the GNU project c and c++ compiler
For simple programs like this hello world:
#include
main()
{
printf("Hello World");
}
Save this as Helloworld.c
the “.c” is the file extension for the C Language
Now to compile this in the terminal, directed to the same folder as the file, type:
gcc -o Run Helloworld.c
gcc is the compiler
-o Run is gearing the output name
Helloworld.c is our file name.
Now in the terminal type:
./Run
To run your Hello world example!
Easy right?!
Any questions or comments please post below
-John Riselvato
