Computer Science Canada I am doing printf functions. What line is my constant string for syntax? |
Author: | php111 [ Sat Jan 10, 2009 6:53 pm ] | ||
Post subject: | I am doing printf functions. What line is my constant string for syntax? | ||
Where is my constant string for syntax? I am getting errors? I am following printf functions. My code has to be right. I know it is right. Why am I getting syntax errors? Here are the errors: Quote: Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp. H:\Documents and Settings\baseball>gcc programming.c -o programming.exe programming.c:1: error: syntax error before string constant programming.c:1: warning: conflicting types for built-in function 'printf' programming.c:1: warning: data definition has no type or storage class programming.c:3: error: syntax error before string constant programming.c:3: warning: data definition has no type or storage class programming.c:5: error: syntax error before string constant programming.c:5: warning: data definition has no type or storage class programming.c:5:64: warning: no newline at end of file H:\Documents and Settings\baseball>
|
Author: | OneOffDriveByPoster [ Sat Jan 10, 2009 9:16 pm ] | ||
Post subject: | Re: I am doing printf functions. What line is my constant string for syntax? | ||
php111 @ Sat Jan 10, 2009 6:53 pm wrote:
|
Author: | wtd [ Sun Jan 11, 2009 12:53 am ] |
Post subject: | RE:I am doing printf functions. What line is my constant string for syntax? |
The "main" function is your C program's "entry point." It's where execution of code starts in any C program. |
Author: | php111 [ Sun Jan 11, 2009 9:40 am ] | ||||
Post subject: | Re: I am doing printf functions. What line is my constant string for syntax? | ||||
I was following the code from the book. I did put in int main() I still get errors. I give my code. I also give the code from the book.
Here is the code from the book...
|
Author: | Vertico [ Sun Jan 11, 2009 11:01 am ] |
Post subject: | Re: I am doing printf functions. What line is my constant string for syntax? |
You are still missing necessary parts for this to work. Go back to your book and read through it carefully, not just the small code snippets. Also look back at your previous thread near the end and see what you are missing. |
Author: | [Gandalf] [ Sun Jan 11, 2009 3:53 pm ] | ||
Post subject: | RE:I am doing printf functions. What line is my constant string for syntax? | ||
Generally a function in C will look like:
Now keep in mind that main is a function, and think about why your code isn't working. |