Lol. Now, it worked. It took a lot. I do have The C Programming book here. It didn't say int or anything.
Printable View
Remake your whole project, php. I think your files got all screwed up, so you tried to fix it by adding the correct file... and so on and so forth. Now your project is just a mess.
This may be a record, 30 posts just to get "Hello world."
I'm not saying it's a record we like, but I guess we'll take what we can get.
Eh? Didn't your posted code have the brace? Go figure. I still don't understand why it is trying to compile a header file during compilation.
Really?
I find it difficult to believe that any book would not teach you how to write main, or how to write any function, for that matter.
A function always begins with aand always ends with aCode:{
. And a function must always return something. And if you don't actually intend to return anything, it should return void.Code:}
Haha. I remember when I was first learning assembler. My hello world app made my system black screen (which if you are a rookie programmer, that is what happens when your computer does something so wrong that it can't even fathom a blue screen).
Furthermore he said he is looking at K&R, right? Don't make me crack open my copy and take a picture to show you that you are wrong. There is no need for us to humiliate eachother at this point.
Well OK, if the book fails to describe how a function looks like, then it's a bad books that should be burned.
Fair enough, yes?
First sticky at the top of the forum, first reply.
The C Programming Language by Brian W. Kernighan and Dennis M. Ritchie.
Good for: Learning the C Programming Language.
Not good for: Learning to program a VCR, learning general programming concepts.. Possibly not ideal if you've never done any programming before, but Your Mileage May Vary.
I really need another book. I keep getting the same errors. The C Programming Language is NO good.
1>------ Build started: Project: C Programming File.c, Configuration: Debug Win32 ------
1>Compiling...
1>C Programming File.c.cpp
1>c:\documents and settings\baseball\my documents\visual studio 2008\projects\c programming file.c\c programming file.c\C Programming File.c.h(3) : error C2144: syntax error : 'int' should be preceded by ';'
1>c:\documents and settings\baseball\my documents\visual studio 2008\projects\c programming file.c\c programming file.c\C Programming File.c.h(3) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>Build log was saved at "file://c:\Documents and Settings\baseball\My Documents\Visual Studio 2008\Projects\C Programming File.c\C Programming File.c\Debug\BuildLog.htm"
1>C Programming File.c - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Code:#include <stdio.h>
library
int main()
{
printf("hello, world!\n");
}
I don't have a copy of K&R, but I am willing to bet any amount you name that the word "library" never appears in a source code example like that.
I have no idea what that "library" word is supposed to do.
Code:#include <stdio.h> include information about standard
library
main() define a function called main
that received no argument values
{ statements of main are enclosed in braces
printf("hello, world\n"); main calls library function printf
to print this sequence of characters
} \n represents the newline character
From the book.
Nowhere does it say you should type "library" anywhere.
All it says is that you include information about the standard library by including <stdio.h>.