473,714 Members | 2,623 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with Non-Aggregate Type Error

1 New Member
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_di m == 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 6113
horace1
1,510 Recognized Expert Top Contributor
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 New Member
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
3077
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 encoded in ISO-8859-1 A a B b C c D d E e É é F f G g H h I i Í í J j 1 2 3 4 5 6 7 8 9 10 11 12 Jh jh K k L l ll M m N n O o P p Q q R r rr S s...
2
7802
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 than half the size, I would prefer to have a non-unicode database for demo purposes to be on my laptop, etc etc
4
6069
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 script that grabs some web pages from the web, regex parse the data and stores it localy to xml file for further use.. at first i had no problem using python minidom and everything concerning
2
2728
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 and was also told that this file is used for screen manipulations... -ambika
4
3067
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 to save it. I have tried creating the object that I place into the DoDragDrop() by inheriting the COM interfaces IDropSource and IDataObject with no luck. If anyone can help I am very much open to suggestions. Thanks in advance!
0
2064
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 using such dialog box on a non-English Windows OS (I'm currently testing on Spanish WinXP Professional). I'm noticing that on non-English Windows OS there are some categories whose
1
1501
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 there is a fuction to use to allow the GUI to be interactive 9Move the window, Cance by clicking a buttonm etc.) Is there such a function in C# to unfreez the app I have and need desperatly to respond!!!
4
1351
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 opperations could be performed with little or no vb programming meaning that a lot of the work necessary for the simple opperations such as writting the CRUD opperations for a table that contains values intended to fill drop down lists or combo...
3
2564
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 expression. ^(.+?) uses (?!a spoon)\.$
399
12835
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 to python-3000@python.org In summary, this PEP proposes to allow non-ASCII letters as identifiers in Python. If the PEP is accepted, the following identifiers would also become valid as class, function, or variable names: Löffelstiel,...
0
8801
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9314
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...
0
9174
jinu1996
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9074
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
9015
tracyyun
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6634
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
4725
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3158
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
2520
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.