472,962 Members | 2,957 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,962 software developers and data experts.

Help with Non-Aggregate Type Error

1
I need help writing a function for a program that is based upon the various operations of a matrix and I keep getting a "non-aggregate type" error. My guess is that I need to dereference my pointers, but I'm not sure. Please help.

The code:
void equate(matrix *A, matrix *B)
{
int i, j;
assert(A.row_dim == B.col_dim && A.col_dim == B.col_dim);

for(i=0; i < A.row_dim; i++)
for(j=0; j < A.col_dim; j++)
A.element[i][j] = B.element[i][j];
}

A and B are supposed to be two different matrices that I will be setting equal to each other...I guess it's sorta like the classic "Swap Function" problem.

The Error:
create.h: In function `void equate(matrix*, matrix*)':
create.h:115: request for member `row_dim' in `A', which is of non-aggregate
type `matrix*'
create.h:115: request for member `col_dim' in `B', which is of non-aggregate
type `matrix*'
create.h:115: request for member `col_dim' in `A', which is of non-aggregate
type `matrix*'
create.h:115: request for member `col_dim' in `B', which is of non-aggregate
type `matrix*'
create.h:117: request for member `row_dim' in `A', which is of non-aggregate
type `matrix*'
create.h:118: request for member `col_dim' in `A', which is of non-aggregate
type `matrix*'
create.h:119: request for member `element' in `A', which is of non-aggregate
type `matrix*'
create.h:119: request for member `element' in `B', which is of non-aggregate
type `matrix*'


Thanks
Mar 6 '07 #1
2 5989
horace1
1,510 Expert 1GB
assuming matrix is something like
Expand|Select|Wrap|Line Numbers
  1. class matrix
  2. {
  3.       public:
  4.       int row_dim, col_dim;
  5.       int element[100][100];
  6. };
  7.  
and the parameters to function equate() are matrix* you use the -> operator to access data members, e.g.
Expand|Select|Wrap|Line Numbers
  1. void equate(matrix *A, matrix *B)
  2. {
  3. int i, j;
  4. assert(A->ow_dim == B->col_dim && A->col_dim == B->col_dim);
  5.  
  6. for(i=0; i < A->row_dim; i++)
  7. for(j=0; j < A->col_dim; j++)
  8. A->element[i][j] = B->element[i][j];
  9. }
  10.  
Mar 6 '07 #2
lqdeffx
39
or you can dereference them as pointers, then you would be able to use the '.' operator; but I that is a matter of preference. personally I don't mind typing an extra character each time and it lets me know at a glance that its a pointer.
Mar 6 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: D. Roshani | last post by:
Hello ! I wonder if any one can help me to create a cosomize sorting order (as Macro or added small program in c++ or c# which does this work) in a Access Database contaning one table only words...
2
by: Rodger Dodger | last post by:
Hi there. We have an application that can run on a non-unicode or a unicode sql server database. Currently the application is running in a unicode database, as a non-unicode database is less...
4
by: webdev | last post by:
lo all, some of the questions i'll ask below have most certainly been discussed already, i just hope someone's kind enough to answer them again to help me out.. so i started a python 2.3...
2
by: ambika | last post by:
Am just a beginner. Can someone please help me know what do non-standard header files mean??? I include the header file "conio.h" in my program.I was told that this is a non-standard header file...
4
by: Dave | last post by:
I need to add the ability to drag from a Windows Form and drop into a non dotNet application. For example, having a generated image in my app that I wish to drag out into explorer as a friendly way...
0
by: Christopher Attard | last post by:
Hi, I need to create a dialog like the 'Add Counters' dialog box in perfmon. I'm using the System.Diagnostics namespace class in .NET and I've managed to do it. The problem arises when I'm...
1
by: WJScott69 | last post by:
I have written an application in C# and have everything I want working except when I kick off the query to other machines VIA WMI it hangs the app until it completes or I kill it. I know in VB...
4
by: WebBuilder451 | last post by:
I really hope i get an answer to this one! At the roll-out of 2.0 ,and before, a lot of emphisis was placed on 2.0 being very friendly to the non-programmer. It was said over and over that CRUD...
3
by: Zach | last post by:
Hello, Please forgive if this is not the most appropriate newsgroup for this question. Unfortunately I didn't find a newsgroup specific to regular expressions. I have the following regular...
399
by: =?UTF-8?B?Ik1hcnRpbiB2LiBMw7Z3aXMi?= | last post by:
PEP 1 specifies that PEP authors need to collect feedback from the community. As the author of PEP 3131, I'd like to encourage comments to the PEP included below, either here (comp.lang.python), or...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.