Explanation of "float" and "ftr[]" in C++

Status
Not open for further replies.

fatma1000

Banned
Joined
Apr 30, 2006
Messages
147
Helped
3
Reputation
6
Reaction score
2
Trophy points
1,298
Location
eygpt
Activity points
0
please explean the mean of
1)
float *x
*x=a*cos(t);

2)
ftr[1]->HY[z+1]=ftr[0]->HY[z+1]-ftr[0]->EX[z+1];

regards

Added after 2 minutes:

sorry explain
not explean
 

Re: help4 c++

1)

float *x

declares a pointer named x

you can make the pointer POINT to a memory location (e.g. a variable of type float) by

float a;
x = &a;

so that *x will give you the value the is stored in 'a', whereas x (without the asterisk) gives you the address to the memory location pointed to by x.





*x=a*cos(t)

stores a*cos(t) - a multiplied by cosine of t
into the memory location pointed to by x






2) ftr[1]->HY[z+1]=ftr[0]->HY[z+1]-ftr[0]->EX[z+1];

ftr is the pointer to a STRUCT. In order to access the members of the structure you have to use the -> operator.

thus, this line subtracts EX[z+1] which is member of ftr[0] from HY[z+1] which is also a member of ftr[0].....and stores the result in HY[z+1] of ftr[1].




YOU NEED TO STUDY POINTERS THOROUGLY....
some nice tutorials and a WONDERFUL C/C++ messageboard can be found at

www.cprogramming.com




--- thanks in advance for clicking HELPED ME
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…