Testing a pure C code on Xcode? -
i trying use latest xcode simulate c code, has nothing iphone, test data manipulation on c functions, , print results see working.
i have started new playground in xcode , ios , gives error when try write c code ( char me[]= "this me" ;
)
how can anyway ? thanks.
the playground swift, not c, hence errors.
you can develop c programs using xcode, want target osx, using command line project template.
start writing main()
:
#include <stdio.h> int main(int argc, const char **argv) { printf("hello world!\n"); return 0; }
edit: in order call function outside of main()
must declare before referenced:
// forward declaration of function static void printit(const char *message); int main(int argc, const char **argv) { printit("hello world\n"); return 0; } static void printit(const char *message) { fwrite(message, 1, strlen(message), stdout); }
Comments
Post a Comment