Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

C language

Status
Not open for further replies.

ednachman

Programmer
Jul 2, 2003
97
0
0
US
Please be patient. I purchased a "Nerdkit" which teaches about electronics for basic inforamtion. It uses the C language for the chip included in the Kit. I purchased a book, "Absolute Beginnner's Guide to C" by Greg Perry. I downloaded a free version of Turbo C++ which is supposed to include plain "C". I copied the first example in the book;

/* Prints a message on the screen */
#include <stdio.h>
main()
{
printf ("This C stuff is easy!\n);
return 0;
}

I then debug and get a message, "Style of function definition is obsolete."

What is obsolete?

Any help is appreciated and I hope you understand my problem

Enjoy Life, this is not a rehearsal
 
Write
Code:
int main()
{...
Default int type in incomplete function header is obsolete. Never use it.
 
I eliminated "main()" and still get the obsolete message.

Enjoy Life, this is not a rehearsal
 
try int main(void) although that should be the same as int main().


James P. Cottingham
[sup]I'm number 1,229!
I'm number 1,229![/sup]
 
#include <stdio.h>
int main()
{
printf ("This C stuff is easy!\n");
return 0;
}

/*Note that you left off the quotes after the '\n' in the printf function. Try that and see if that helps. The above code should now work*/
 
Well, this thread is obsolete, but the right C-solution was presented by 2ffat:
Code:
int main(void)
It's not the same as
Code:
int main() // that's OK in C++
in the C language.
 
If you also look at the code asked by ednachman, the printf had an error in the string it displayed because the quotes at the end was left off
 
If you also look at the OP question...
It's a misprint, not obsolete style ;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top