Hello I've started a programming in C course for my engineering degree. At the moment I'm using Visual C++/C to do this but I was just wondering if there is a similar variant for mac as I prefer to work in OSX than XP.
Thanks for any help.
It looks gr8 but unfortunately I haven't been able to get even a simple hello world in C to work. I just get like 120 errors, have no idea what is going on.
If anyone does know of a tutorial site or similar that would be awesome
right so I just want write a simple C code to begin with. I thought this was how I would go about doing it. Xcode>new project>blank project>new file>c file.
I then input this code in
/*hello world*/
include <stdio.h>
main()
{
printf ("hello world\n");
}
If that helps what I'm on about.
I'm used to using visual c++/C for this so I didn't really know what to do for some things. For instance where I regularly use (hash symbol)include etc. What do I do as macs don't seem to have a hash key
you are including a header file, does that header file exist?
cat > myprog.c
#include <stdio.h>
int main(void) {
printf("Hello World!\n") ;
return 0 ;
}
CTRL+D
gcc myprog.c -o myprog
./myprog
I use Xcode every day for C/C++ programs and it's great. You can, however, also use the command line in Terminal. It's pretty simple.
Code:cat > myprog.c #include <stdio.h> int main(void) { printf("Hello World!\n") ; return 0 ; } CTRL+D gcc myprog.c -o myprog ./myprog
is all it takes. 😉
When doing this in terminal how would you get the hash for the #include <stdio.h> because I don't have one on my keyboard and even if I use a windows keyboard the hash key just turns into a backslash.