I understand *why* this produces an error and how to correct it, (add
parentheses) but the error itself is a bit eclectic? As I am sure this
will arise again, could anyone throw some logic at it.
int main (int argc, const char * argv[]) {
struct point {
int x;
int y;
};
struct point *pp;
struct point origin;
pp= &origin;
origin = makepoint(23, 67);
printf("%d, %d\n", (*pp).x, *pp.y); /*error: request for member 'y'
in something not a structure or union*/
}
Thanks in advance 6 2256
On Aug 23, 6:41 pm, mdh <m...@comcast.n etwrote:
I understand *why* this produces an error and how to correct it, (add
parentheses) but the error itself is a bit eclectic? As I am sure this
will arise again, could anyone throw some logic at it.
int main (int argc, const char * argv[]) {
struct point {
int x;
int y;
};
struct point *pp;
struct point origin;
pp= &origin;
origin = makepoint(23, 67);
printf("%d, %d\n", (*pp).x, *pp.y); /*error: request for member 'y'
in something not a structure or union*/
}
See operator precedence.
.. bounds tigher than *
*pp.y means *(pp.y)
pp is a pointer, . requires structure or union
mdh wrote:
I understand *why* this produces an error and how to correct it, (add
parentheses) but the error itself is a bit eclectic? As I am sure this
will arise again, could anyone throw some logic at it.
int main (int argc, const char * argv[]) {
struct point {
int x;
int y;
};
struct point *pp;
struct point origin;
pp= &origin;
origin = makepoint(23, 67);
printf("%d, %d\n", (*pp).x, *pp.y); /*error: request for member 'y'
in something not a structure or union*/
}
Thanks in advance
It's a snytax error. As written *pp.y assumes pp a structure and y a
pointer to int. None of that is true.
--
Joe Wright
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
On Aug 23, 8:57*am, Joe Wright <joewwri...@com cast.netwrote:
mdh wrote:
I understand *why* this produces an error and how to correct it,
snip
int main (int argc, const char * argv[]) {
struct point {
* *int x;
* *int y;
};
* *struct point *pp;
* *struct point origin;
* *pp= &origin;
>
* *printf("%d, %d\n", (*pp).x, *pp.y); */*error: request for member 'y'
in something not a structure or union*/
>
It's a snytax error. As written *pp.y assumes pp a structure and y a
pointer to int. None of that is true.
Thanks Joe...yes that makes sense. One more eclectism falls :-)
On Aug 23, 8:57*am, vipps...@gmail. com wrote:
>
pp is a pointer, . requires structure or union
thanks
On Sat, 23 Aug 2008 11:57:15 -0400, Joe Wright wrote:
mdh wrote:
> struct point *pp; [...] printf("%d, %d\n", (*pp).x, *pp.y); /*error: request for member
'y'
>in something not a structure or union*/
It's a snytax error.
No, it's not, unless snytax is an intentional misspelling that I am not
familiar with. *pp.y is syntactically valid, but semantically invalid.
On 23 Aug, 16:41, mdh <m...@comcast.n etwrote:
I understand *why* this produces an error and how to correct it, (add
parentheses) but the error itself is a bit eclectic? As I am sure this
will arise again, could anyone throw some logic at it.
int main (int argc, const char * argv[]) {
struct point {
* * * * int x;
* * * * int y;
};
* * * * struct point *pp;
* * * * struct point origin;
* * * * pp= &origin;
* * * * origin = makepoint(23, 67);
* * * * printf("%d, %d\n", (*pp).x, *pp.y); */*error: request for member 'y'
in something not a structure or union*/
}
Thanks in advance
Erm, it seems to make perfect sense to me. The '.' means you are
accessing a member of a struct or union, so pp.y means "access the
member called 'y' of the struct or union pp". Which is wrong, beacause
pp is not a struct or union - it is a pointer to a struct. So pp isn't
a struct or a union, and it doesn't have members. So it's an error to
access member 'y' of it. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: kosuke |
last post by:
I keep getting the following error/warning message when using the
python based program getmail4:
/usr/lib/python2.3/optparse.py:668: FutureWarning: %u/%o/%x/%X of
negative int will return a signed string in Python 2.4 and up
return ("<%s at 0x%x: %r>"
I'm using python2.3.5 on a debian sid box.
The getmail4 website/FAQ maintains that...
|
by: Bill |
last post by:
I have perhaps not explained myself clearly, so I'll try it this way.
In the code below, where it says "I'd like to include my navigation
bar here" is the place I'd like to insert a navigation bar from a page
I have called navbar.asp
For some reason, when I insert the <! #include file="navbar.asp" -->
in that place, I get an error, a long,...
|
by: Steve Bywaters |
last post by:
There are several hundred of my client's franchisees happily accessing my
ASP/VBscript web site... but one - just one - has reported the following:
"I have been trying to log onto the LSM since friday and get this message
when I want to go into any of the items on Home Page.
Response object error
'ASP 0156: '80004000'
Header error...
|
by: dmiller23462 |
last post by:
Hey guys, I'm back again....I've got the results displaying that I
wanted but instead of having a "next" or "previous" link displayed I
am getting the error msg below (I actually get the data that I'm
supposed to get meaning that my query seems to be working fine but
instead of making its way to the INCLUDE file (bottom navigation bar)
it...
|
by: Bob |
last post by:
Hi Everybody
I hope you can help.
2 related questions.
1. I am looking for a way to replace the confusing message box that comes up when a user trys to
open a form without putting data in it.
ie ..Syntax Error(Missing Operator) In queryexpression '=" & Me!
DoCmd.OpenForm stDocName, , , stLinkCriteria
| |
by: Thelma Lubkin |
last post by:
I use code extensively; I probably overuse it. But I've been using
error trapping very sparingly, and now I've been trapped by that.
A form that works for me on the system I'm using, apparently runs into
problems on the system where it will actually be used, and since I
used so little error-trapping it dies very ungracefully.
I will of...
|
by: Blah |
last post by:
In MSDN documentation it states..
Remarks
The constant declaration can declare multiple constants,
for example:
public const double x = 1.0, y = 2.0, z = 3.0;
The static modifier is not allowed in a constant
declaration.
A constant can participate in a constant expression, for
example:
|
by: Anthony England |
last post by:
(sorry for the likely repost, but it is still not showing on my news server
and after that much typing, I don't want to lose it)
I am considering general error handling routines and have written a sample
function to look up an ID in a table. The function returns True if it can
find the ID and create a recordset based on that ID, otherwise...
|
by: Tony Girgenti |
last post by:
Hello.
I'm developing and testing a web application using VS.NET 2003, VB, .NET
Framework 1.1.4322, ASP.NET 1.1.4322 and IIS5.1 on a WIN XP Pro, SP2
computer. I'm using a web form.
I'm trying create a function in javascript to compare dates between calendar
selected dates(that's not really my problem yet).
I can't get the html to...
|
by: i |
last post by:
#include<stdio.h>
#include<conio.h>
#include<process.h>
#include<string.h>
char ch;
int n,m;
void main();
char check(int,int,char);
void cash(int,int,char);
void debit_card(int,int,char);
|
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. ...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
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...
|
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...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |