Skip to content

How to Program in C with Xcode on Mac (VIDEO)

Learn how to create, compile and run a C project with Xcode on your Mac. Watch the video tutorial and grab the sample code used in it.

Ricardo Moya

Xcode is not just a development environment for programming in Objective-C. It also lets you program in other programming languages such as C, C++, Java, Pascal, Ada and Perl, since it includes the compilers for these languages.

If you’re lucky enough to have a Mac (for work, obviously), use Xcode to program in C and C++, since you won’t waste time setting up other development environments that let you program and compile in C and C++. On the other hand, to program in other languages like Java, Python, PHP, etc., you’re better off using the Eclipse or Aptana development environments, since they are much more complete and easier to use and install.

Below is a video showing how to create a C project with Xcode, and how to compile and test it:

The test code used in this video tutorial is below:

 


#include <stdio.h>

int main(int argc, const char * argv[])
{

    printf("Hello, World!n");

    // We do a multiplication and print it to the screen
    int multipliplicacion = 0;
    multipliplicacion = 6*5;
    printf("Resultado de la Multiplicacion: %d n",multipliplicacion);

    // We print the numbers from 0 to 19 to the screen
    printf("nNumeros del 0 al 19, imprimidos de uno en uno n");
    for (int i=0; i<20; i++) {
        printf("%d ",i);
    }
    return 0;
}

“How to Program in C with Xcode on Mac (VIDEO)” by Ricardo Moya at jarroba.com, licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0. Registered at Safe Creative.

Ricardo Moya

I work in Machine Learning and Big Data. I like learning new technologies and explaining them as clearly as I can on this site.

You may also like

NSTimer in Objective-C: Example (Video)

Learn how NSTimer works in Objective-C with a simple video tutorial: an app that increments an integer variable every second. Project download included.

Aug 30, 2012

Comments

Leave a comment


This site uses Akismet to reduce spam. Learn how your comment data is processed.