Hi,
I am having problems with this program. I keep on getting the following error messages:
testing.c: In function `next_month':
testing.c:25: error: parameter name omitted
testing.c:27: error: syntax error before "mnth"
My code is: -
#include <stdio.h>
-
-
enum month {jan=0, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec};
-
-
typedef enum month mnth;
-
-
mnth next_month(int);
-
-
int main(void)
-
{
-
int x;
-
mnth k;
-
-
printf("Enter. ");
-
scanf("%d", x);
-
-
k = (next_month(x));
-
-
printf("%s", k);
-
-
return 0;
-
-
-
-
mnth next_month(int)
-
{
-
return ((mnth) (((int) mnth +1 % 12));
-
}
-
-
Thanks!
2 26748 Banfa 9,065
Recognized Expert Moderator Expert
line 25 you define an int parameter without naming it (only C++ and C99(?) can have anonymous parameters).
Then at line 27 you treat the type mnth as though it is a variable when you try mnth + 1 donbock 2,426
Recognized Expert Top Contributor
You are missing the closing bracket for the main function.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Chris Herring |
last post by:
Hi there: Well, let me start off by saying that I am a Visual Studio drag
and drop weenie, not a real programmer. So I tend to get confused when
things do not look like the instructions said they were going to look :) .
Here is my current dilemma:
I am having a strange problem with my ASP.NET application. I am building the
application using Visual Basic .Net in Visual Studio.NET 2003. Lately, I
have frequently been getting the following...
|
by: Florian Loitsch |
last post by:
I'm currently writing a JS->Scheme compiler (which, using Bigloo,
automatically yields a JS->C, JS->JVM, JS->.NET compiler), and have a
question concerning the function-parameters:
According to the spec (10.1.6) the activation-object already contains the
the parameters-object when the variables are instantiated (10.1.3). The
question is now: does a parameter "parameters" overwrite the
"parameters"-object or not?
All three implementations...
|
by: ben |
last post by:
hello,
an algorithm book i'm reading talks about the connectivity
problem/algorithm.
it gives a number of examples where the connectivity problem applies to
real life situations (like, the objects may represent computers in a
large network and the pairs represent connections between them)
another real situation example that's given is:
|
by: Dave Hansen |
last post by:
Please note crosspost.
Often when writing code requiring function pointers, it is necessary
to write functions that ignore their formal parameters. For example,
a state machine function might take a status input, but a certain
error-handling state might ignore it:
typedef void (*State_Fn)(uint8_t);
void error_state(uint8_t status)
|
by: Reader |
last post by:
On a windows form, there is TableLayoutPane. I
1) Increase size of form
2) Increse size of table
3) Add a row in the table
4) Save
I receive exception "Value cannot be null. Parameter name: context".
Any suggestions...highly appreciated.
| |
by: Godlove Mathew |
last post by:
Hi, I installed a Borland C++ in my laptop a 32-bit operating system with windows vista.
I wrote i very simple program to display "Hello world" but it gives an error
// my first program in C++
#include <iostream>
using namespace std;
int main ()
|
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,...
|
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...
|
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,...
|
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...
|
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...
| |
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |