Category Archives: C

ANSI C, C++ & Objective-C

Fibonacci and C arrays- the perfect combo

New year upon us and back to the C training. Tonights mission was to output Fibonacci numbers via an array. The Fibonacci sequence is a sequence of numbers where the next number is the sum of the previous 2 numbers. … Continue reading

Posted in C, Perl | Tagged , , | Leave a comment

C character arrays (K&R exercice 1-17)

Back on the K&R book, still working through the ‘Tutorial Introduction’ and in the character array section. Here is my solution to Exercise 1-17: print out all lines with 80 or more characters. #include <stdio.h> #define MAXLINE 1000 // This … Continue reading

Posted in C | Tagged , , , , | Leave a comment

Starting C for Perl coders

In my quest to write an ‘app’ for the iPhone, I’ve been sidetracked into learning ANSI-C from scratch to give me a grounding for C++ and Objective-C. Why you may ask? Well it occurred to me that as FreeBSD in … Continue reading

Posted in C | Tagged , , , , | Leave a comment

C Arrays

Here are some C programs from the K&R book with reference to arrays. This resonated with the Perl hashes as this task is nearly always done with a hash, but as C has no hashes, here we go with an … Continue reading

Posted in C | Tagged , , , | Leave a comment

Objective-C decisions vs Perl descisions

I’m comparing Objective-C decision making with our beloved Perl decision making. Objective-C supports the if, else, else if & switch. Lets write some Objective-C code and write the Perl in parallel. #import <Foundation/Foundation.h> int main (int argc, const char * … Continue reading

Posted in C, Perl | Tagged , , , , | Leave a comment

Objective-C loops

After finding another hour to read some more ‘Objective-C’ instruction, I’ve covered some looping techniques which are all again valid in Perl and ANSI C. My text covers the for, while and do loops, and heres the sample program… #import … Continue reading

Posted in C | Tagged , , , , | Leave a comment

Finally! Started on Objective C

I’ve finally got round trying some Objective C programming beyond outputting “hello world” with what is in effect ANSI C. I’m coming from a Perl background with a a smattering of other experience such as ANSI C, ASP and PHP … Continue reading

Posted in C | Tagged , , | Leave a comment

Objectionable C

Clearly my day to day work with Perl was not taking up enough time and I’m ‘quite’ interested making an iPhone application, so here i am at the gates of ‘Objective C’ and looking for that elusive ‘Hello World’. At … Continue reading

Posted in C | Tagged , , | Leave a comment