Thread: Newbie issues programming C w/i Xcode

  1. #1
    Registered User
    Join Date
    Jun 2010

    Newbie issues programming C w/i Xcode


    I'm completely new to programming. I heard great things about the book, "C by Example," and fortunately, my library has an ebook version of it. For the very first program the book instructs us to run, I copied and pasted the code directly from the ebook into Xcode, but it won't run! I'm totally new, so just trying to get a hang of things. Any ideas of what's going on?


    Screen shot 2010-06-08 at 7.32.38 PM.png

  2. #2
    Make Fortran great again
    Join Date
    Sep 2009
    The double single quotes (') at the beginning of the printf statement should be a single double quote (")

  3. #3
    Registered User
    Join Date
    May 2010
    Why don't you just post the code ?

  4. #4
    Registered User
    Join Date
    Mar 2009
    '' (two single quotes) is not the same thing as " (double quote).

    main returns an int.
    int main(void)

  5. #5
    Registered User
    Join Date
    Jun 2010
    Thanks guys, the quote was the issue. I haven't gotten to the chapter where we learn to analyze the structure of C code, so I was totally oblivious to that being the issue. I just couldn't figure out why a direct copy and paste of the code wouldn't run!

    I'm glad to have found a forum with such a great community as I take on the huge endeavor of learning C (and later Objective-C)!

    BTW, for those interested, the code is below:

    /* Filename: C1FIRST.C
    Requests a name, prints the name 5 times, and rings a bell */

    #include <stdio.h>
    #define BELL '\a'

    int ctr=0; /* Integer variable to count through loop */
    char fname[20]; /* Define character array to hold name */

    printf("What is your first name? "); /* Prompt the user */
    scanf(" %s", fname); /* Get the name from the keyboard */
    while (ctr < 5) /* Loop to print the name */
    { /* exactly 5 times */
    printf("%s\n", fname);
    printf("%c", BELL); /* Ring the terminal's bell */
    return 0;

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 6
    Last Post: 03-09-2011, 06:38 AM
  2. Need help from you Xcode users
    By Memloop in forum Tech Board
    Replies: 7
    Last Post: 09-22-2009, 10:27 AM
  3. Replies: 16
    Last Post: 04-20-2008, 01:15 PM
  4. open gl newbie issues
    By phil_drew in forum Windows Programming
    Replies: 3
    Last Post: 10-30-2003, 03:26 PM
  5. Newbie Game Develpoers Unite!
    By Telenosis in forum Game Programming
    Replies: 10
    Last Post: 06-22-2002, 02:02 PM