Hi guys,
I want to start programming in C on my MacBook. I tried all the ways I can, to compile the very basic program, but failed. Please help me.
#include <stdio.h>
main()
{
*printf("Hello world \n");
}
Error Message:
dhcp-018-125:Cfiles ram$ gcc -o rn1 world.c
world.c: In function main:
world.c:4: error: stray \194 in program
world.c:4: error: stray \160 in program
Methods followed: 3
1.
I tried writing this code in Textwrangler and then compiled using the option 'Run in the terminal' by adding 'shebang' (#! /bin/sh), code is compiled but could not find the output of printf statement,
Output:
Last login: Wed Jul 30 01:03:19 on ttys001
/var/folders/bM/bMtn-hXkGOmPCW7lipJokk+++TI/Cleanup\ At\ Startup/helloWorld-239090206.981.c.command ; exit;
dhcp-018-125:~ ram$ /var/folders/bM/bMtn-hXkGOmPCW7lipJokk+++TI/Cleanup\ At\ Startup/helloWorld-239090206.981.c.command ; exit;
logout
[Process completed]
Method 2 & 3:
Both of these 2 methods are similar in the way of compiling, in both the ways I used terminal, but the codes were written in textwrangler & textedit.
command in the terminal:
dhcp-018-125:Cfiles ram$ gcc -o rn1 world.c
Got the same error message:
world.c: In function main:
world.c:4: error: stray \194 in program
world.c:4: error: stray \160 in program
Guys, sorry for the long message, but all day I tried to compile with all possible ways, but no luck.
Any help will be appreciated.
I want to start programming in C on my MacBook. I tried all the ways I can, to compile the very basic program, but failed. Please help me.
#include <stdio.h>
main()
{
*printf("Hello world \n");
}
Error Message:
dhcp-018-125:Cfiles ram$ gcc -o rn1 world.c
world.c: In function main:
world.c:4: error: stray \194 in program
world.c:4: error: stray \160 in program
Methods followed: 3
1.
I tried writing this code in Textwrangler and then compiled using the option 'Run in the terminal' by adding 'shebang' (#! /bin/sh), code is compiled but could not find the output of printf statement,
Output:
Last login: Wed Jul 30 01:03:19 on ttys001
/var/folders/bM/bMtn-hXkGOmPCW7lipJokk+++TI/Cleanup\ At\ Startup/helloWorld-239090206.981.c.command ; exit;
dhcp-018-125:~ ram$ /var/folders/bM/bMtn-hXkGOmPCW7lipJokk+++TI/Cleanup\ At\ Startup/helloWorld-239090206.981.c.command ; exit;
logout
[Process completed]
Method 2 & 3:
Both of these 2 methods are similar in the way of compiling, in both the ways I used terminal, but the codes were written in textwrangler & textedit.
command in the terminal:
dhcp-018-125:Cfiles ram$ gcc -o rn1 world.c
Got the same error message:
world.c: In function main:
world.c:4: error: stray \194 in program
world.c:4: error: stray \160 in program
Guys, sorry for the long message, but all day I tried to compile with all possible ways, but no luck.
Any help will be appreciated.