Using Xcode to implement the first C language program--hello World

Source: Internet
Author: User

Recently you've been using Xcode to learn oc,swift and develop iOS apps. Idle to dull, want to write a few C programs on the Mac. Previously in Windows, we used to use vc++,visual Studio, and so on C or C + + ides, but what environment should we use to learn C in a Mac? The answer is, of course, Xcode. Xcode currently supports a swift,objective-c,c,c++ of four languages. Let's use Xcode to write a HelloWorld.

The specific implementation steps are as follows:

(1) Install command line Tool on Mac, if not installed, please refer to my other blog "Command line tools installation Method" in Xcode.

(2) Open Xcode, select "Create a new Xcode project", then under OS X, select Application, and on the right, select "Command line Tool" as shown in:


(2) then enter the project name, in the following language select C, of course, there are several other languages can choose: Finally select the workspace, create.


(3) After the project is created, the directory structure is as follows: We are very familiar with the. c File:


(4) Open main.c, you can see the very familiar C language code, the system has automatically generated a part of the code, including the output Hello World.

#include <stdio.h>int main (int argc, const char * argv[]) {    //Insert code    here ... printf ("Hello, world!\n");    return 0;}

The output results are as follows:


Summing up, after the above steps, we in the Xcode environment in C language written by the Hello World is done. Code it out for yourself.


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Using Xcode to implement the first C language program--hello World

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.