473,698 Members | 2,196 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Novice question..

Here is the code..

#define NAME "MEGATHINK, INC"
#define ADDRESS "10 Megabuck Plaza"
#define PLACE "Megapolis, CA 94904"

int main()
{
starbar();
printf("%s\n",N AME);
printf("%s\n",A DDRESS);
printf("%s\n",P LACE);
starbar();
}

#include <stdio.h>
#define LIMIT 65
starbar()
{
int count;
for (count=1;count< =LIMIT;count++)
putchar('*');
putchar('\n');
}

it shows me the following warning message

implicit declaration of function 'starbar'
implicit declaration of function 'printf'
control reaches end of non-void function

Could anyone explain why this happens.. i'm still having hard time
learning C

thanks in advance.
Nov 13 '05 #1
3 2236
>Subject: Novice question..
From: "herrcho" he*********@kor net.net
Date: 8/9/03 4:52 PM Hawaiian Standard Time
Message-id: <bh**********@n ews1.kornet.net >

Here is the code..

#define NAME "MEGATHINK, INC"
#define ADDRESS "10 Megabuck Plaza"
#define PLACE "Megapolis, CA 94904"

int main()
{
starbar();
printf("%s\n",N AME);
printf("%s\n",A DDRESS);
printf("%s\n",P LACE);
starbar();
}

#include <stdio.h>
#define LIMIT 65
starbar()
{
int count;
for (count=1;count< =LIMIT;count++)
putchar('*');
putchar('\n');
}

it shows me the following warning message

implicit declaration of function 'starbar'
You didin't have a function definition for starbar when the compiler reached
the declaration. It will assume you meant

int starbar();

Which is not what you meant.

Put the include and function definition for starbar on top.implicit declaration of function 'printf'
see above.
control reaches end of non-void function
You declare main to return an int. Yet you have no "return" statement in main.
Could anyone explain why this happens.. i'm still having hard time
learning C


Well, it wasn't that bad. Just put things in the right order..

Stuart
Nov 13 '05 #2
#include <stdio.h>
#define LIMIT 30

#define NAME "MEGATHINK, INC"
#define ADDRESS "10 Megabuck Plaza"
#define PLACE "Megapolis, CA 94904"

int starbar();

int main()
{
starbar();
printf("%s\n",N AME);
printf("%s\n",A DDRESS);
printf("%s\n",P LACE);
starbar();
}

starbar()
{
int count;
for (count=1;count< =LIMIT;count++)
putchar('*');
putchar('\n');
}
Nov 13 '05 #3
herrcho wrote:
Here is the code..

#define NAME "MEGATHINK, INC"
#define ADDRESS "10 Megabuck Plaza"
#define PLACE "Megapolis, CA 94904"

int main()
{
starbar();
printf("%s\n",N AME);
printf("%s\n",A DDRESS);
printf("%s\n",P LACE);
starbar();
}

#include <stdio.h>
#define LIMIT 65
starbar()
{
int count;
for (count=1;count< =LIMIT;count++)
putchar('*');
putchar('\n');
}

it shows me the following warning message

implicit declaration of function 'starbar'
Because you use starbar() in your main() function /before/ you define it.
Your definition of starbar() follows, later in your source code.
implicit declaration of function 'printf'
Because you use printf() in your main() function /before/ you define it.
Your definition of printf() follows; it comes from the
#include <stdio.h>
control reaches end of non-void function
You do not define starbar() to return any explicit type of value, so (as is the
C89 standard), it defaults to returning an int ("implicit int" in the standard).
However, your starbar() function neglects to explicitly return an int value (it
does not have a return statement that returns an int), so the compiler warns you
about this nonstandard behaviour.

Could anyone explain why this happens.. i'm still having hard time
learning C

thanks in advance.

--
Lew Pitcher

Master Codewright and JOAT-in-training
Registered Linux User #112576 (http://counter.li.org/)
Slackware - Because I know what I'm doing.

Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
1731
by: Christopher Richards | last post by:
It is possible to be able to receive email alerts (say, from Google News) and publish them to a web page automatically? I am a novice as far as PHP goes, but I can open and write to a file and close the file up again. The html page references the file and can format the plain text. So far I am OK ( I think ). I am not sure how I would automate, or get the content of the email, and output it to a file. Any thougths? Thank you.
5
2366
by: Marian | last post by:
Hi, I am totaly novice in .NET and I am studying a book about this. There was mentioned "assembly". I did not understand, how function does it has . I would like to know the exact run of code (intermediate language and so on). Is there any page on internet, which makes me clear? Thanx
2
2011
by: George | last post by:
Is this group for a novice C++ programmers?
21
2932
by: AES/newspost | last post by:
My understanding -- I'm not an expert -- is that on (some? many? all?) standard Internet servers a URL can point to a subdirectory name followed by a backslash, and that links to this URL will automatically go to an "index.html" file located in that subdirectory, if there is one. Q1: Is this more or less correct? At least some HTML texts also recommend using this as the basis for organizing a web site: Put the web pages associated...
6
3438
by: ronwer | last post by:
Hello, The title doesn't completely cover the question I have, but it's a bit more complicated problem we have. We are using a database, based on Acces, but developed by a third party developer who sells it under his own name. So, functionally it's a very specific database for a specific purpose. Now we want to make certain changes in this database, but for reasons of
2
2259
by: Dmitry Sazonov | last post by:
I'm novice here and I'm sorry for stupid question. We are trying to understand web services architecture, is it better than TIBCO.Randevouz and does webservices fit our needs. I understand, I can make web servce and a client applicaiton. Client will call the service and will receive some kind of responce. But can my client applicaiton receive EVENT from web service? Can I "subscribe" to, let say, "Clock" web service and web service...
1
2542
by: Christo | last post by:
I have a question please this is just theory at the moment I am a novice java programmer Is it possible for me to write information to a hashmap and then once it has been written to extract a certain piece of information in that hash map and store it in a variable then manipulate the information stored in the variable and then put the information from the variable back into the hashmap in the place that i got
1
2999
by: TwistedSpanner | last post by:
Hello all, For the record I am a complete java novice. I have to write a program to generate/output to screen 10 simple maths question and output a final score . The question is as follows Random number, Random operator (+ or -) random number. I have written the program but cannot make the random operator work. Can anyone help? My code.
9
3054
by: Kelii | last post by:
I've been trying to get this piece to work for a few hours, but have given up. I hope someone out there can help, I think the issue is relatively straightforward, but being a novice, I'm stumped. Below you will find the code I've written and the error that results. I'm hoping that someone can give me some direction as to what syntax or parameter is missing from the code that is expected by VBA. Overview: I'm trying to copy calculated...
0
8609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9170
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8901
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7739
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6528
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2336
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.