ClassCertificates not doing anything?


#1

I just got to the ClassCertificates portion of this chapter. I’ve entered the code (seemingly) exactly as it appears in the book, but when I build and run, nothing is in the output field. No errors or warnings (not even the expected one), just nothing. 10.8.4, Xcode 4.6.3.

My Code:

[code]//
// main.c
// ClassCertificates
//
// Created by Eric Daigle on 2013-07-19.
// Copyright © 2013 Eric Daigle. All rights reserved.
//

#include <stdio.h>

void congratulateStudent(char * student, char * course, int numDays)
{
printf("%s has done as much %s Programming as I could fit into %d days.\n",
student, course, numDays);
}

int main(int argc, const char * argv[])
{
congratulateStudent(“Mark”, “Cocoa”, 5);
congratulateStudent(“Bo”, “Objective-C”, 2);
congratulateStudent(“Mike”, “Python”, 5);
congratulateStudent(“Ted”, “iOS”, 5);

return 0;

}[/code]


#2

UPDATE: Figured it out. In case anyone else has this problem, the printf inside congratulateStudent needs to all be on one line. Stupid error by me. :frowning:


#3

No, that was not the problem.
Your original program is good.
You can spread a printf statement over multiple lines:

#include <stdio.h>

void congratulateStudent(char * student, char * course, int numDays)
{
    printf ("%s has done as much %s Programming"
           " as I could fit into %d days.\n",
           student,
           course,
           numDays);
}

int main (int argc, const char * argv[])
{
    congratulateStudent ("Mark", "Cocoa", 5);
    congratulateStudent ("Bo", "Objective-C", 2);
    congratulateStudent ("Mike", "Python", 5);
    congratulateStudent ("Ted", "iOS", 5);
    return 0;
}

So why did you not see any output?


#4

I… honestly don’t know. The only difference I can spot between your code and mine is the whitespace, which AFAIK in C doesn’t matter to the compiler. I can’t figure out what I’m missing :frowning: