| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Structures type?
When you create a structure , it can make a new type of data aside from int, double, etc.
Can you declare a function with the new type? for example: Quote:
How do I fix this? EDIT!: The problem seems to be more with the bold realnumber |
|
#2
|
|||
|
|||
|
You can do this but you need to do one of two things.
1) Put the keyword struct before realnumber in the function definition line. 2) Typedef the struct to let you use a single word. So either - Code:
struct realnumber
{
double real;
double angle;
};
struct realnumber topolar (struct realnumber number) {}
or Code:
typedef struct rn
{
double real;
double angle;
} realnumber;
realnumber topolar (realnumber number) {}
Hope this helps, -KM- |
![]() |
| Viewing: Dev Articles Community Forums > Programming > C/C++ Help > Structures type? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|