473,383 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

det_Z(A).r instead of z.r

Hello,

If the function det_Z(), is of this type :

complexZ det_Z(double **A);

Can I write :

do
{
r_mZ(A,999.);
printf(".");
}while(!det_Z(A).r);
instead of

complexZ z;

do
{
r_mZ(A,999.);
z = det_Z(A);
printf(".");
}while(!z.r);

Thank

http://groups.yahoo.com/group/mathc/

Sep 3 '06 #1
3 1563
"xhungab" <xh*****@yahoo.frwrote:
If the function det_Z(), is of this type :

complexZ det_Z(double **A);

Can I write :

do
{
r_mZ(A,999.);
printf(".");
}while(!det_Z(A).r);

instead of

complexZ z;

do
{
r_mZ(A,999.);
z = det_Z(A);
printf(".");
}while(!z.r);
Sure, provided a complexZ has a member called r which is a scalar - but
if it didn't, your second snippet wouldn't work, either.

Richard
Sep 4 '06 #2
xhungab wrote:
Hello,

If the function det_Z(), is of this type :

complexZ det_Z(double **A);
You haven't completely specified the type, since you haven't told us
what a complexZ is. But it is clear that det_Z is a function that takes
a pointer to pointer to double, and returns a complexZ. Whatever that is.

You also haven't told us what this function is supposed to do.
Can I write :

do
{
r_mZ(A,999.);
printf(".");
}while(!det_Z(A).r);
How are we to know, without the declaration of r_mZ, A, and complexZ?

You haven't told us what type A is. It should be a pointer to pointer to
double, or perhaps pointer to void, if the above code is correct.

You haven't told us what type complexZ is. It should be a struct
containing at least one member, named r, of an arithmetic or pointer type.

You haven't told us what the type of r_mZ is. It should be a function
taking two arguments: (1) a pointer to pointer to double and (2) a
double. It should probably return void, but it may return something else
if you ignored its return value above.
instead of

complexZ z;

do
{
r_mZ(A,999.);
z = det_Z(A);
printf(".");
}while(!z.r);
The code above is equivalent to the previous code. The exception is that
the value of z is still available after the loop in case you still
wanted to use it.

I suppose the question should have been:

"Can I use the struct member access operator (.) directly
on the return value of a function?"

struct foo {int a;};

struct foo bar(void)
{
return (struct foo){0};
}

int main(void)
{
return bar().a;
}

The answer is, yes, you can.

--
Simon.
Sep 5 '06 #3
You are right.
>I suppose the question should have been:

"Can I use the struct member access operator (.) directly
on the return value of a function?"
Thank for your answer.

Ps:

typedef struct
{
double r;
double i;
} complexZ,
*pcomplexZ;

It is a pointer on a complex matrix.
I have try to follow the indication given
into the group "comp.lang.c"
But I have customized the method.
double **A;

r for rand.
void r_mZ(double **A, int n);

det for determinant.
complexZ det_Z(double **A);

Sep 5 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Aardwolf | last post by:
I've had PHP on my Win2K server running IIs 5 for about 2 weeks now. I have an annoying problem in that I can not run the php scripts/pages locally, instead they open up in the browser as a...
7
by: svilen | last post by:
hello again. i'm now into using python instead of another language(s) for describing structures of data, including names, structure, type-checks, conversions, value-validations, metadata etc....
8
by: joe | last post by:
hi i am trying to write a insted of insert trigger to create a unique id when i insert a record in my database. can anyone give me an example with out using identity. thanks
3
by: cfxchange | last post by:
I am looking into work-arounds for what seems to be a flaw, or "undocumented feature" of SQL Server replication and Instead of Delete triggers not playing together. It seems that if you want to...
8
by: Stuart McGraw | last post by:
Is Microsoft full of #*$#*% (again) or am I badly misunderstanding something? Quote from Microsoft's T-SQL doc: > INSTEAD OF triggers are executed instead of the triggering action. > These...
5
by: Chris | last post by:
I'm attempting to get Instead Of triggers working. My platform in Solaris, DB2 verison 8.1.x (not sure which). If I create two simple tables with 1 row each: create table test_cc_1 (col1...
25
by: dixie | last post by:
I have some code that adds new records into a table for each ID in a list box when a button on a form is clicked. This works fine. My problem now is that I wish to be able to edit all the records...
4
by: Jim Hammond | last post by:
It would be udeful to be able to get the current on-screen values from a FormView that is databound to an ObjectDataSource by using a callback instead of a postback. For example: public void...
12
by: comp.lang.php | last post by:
I am using CLI PHP to run a PHP script, c:\wamp\php\php.exe, but instead of executing my script, it's actually displaying the raw code instead. How can I run my code using CLI PHP? I installed...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.