Guys,
think at solving a linear system of equations.
You can use a function like
void Solver(double A[], double B[], double *X)
where you pass two vectors A and B and the result is returned in X vector.
I want to pass to the function Solver my vector of structures (but not all, just the...
My question is allmost what jfhuang answered. GetVal(n->attribute1); works fine for a scalar but how to do for a vector, because something like GetValue(n(i)->attribute1) won't work (sorry for the round brackets!).
So i think what Zyrenyhian answerd is closer to my question.
Thanks both
Can it be passed to a function just a member of a struct so that the function changes that member?
Let's say a have a struct
struct node {
double attribute1, attribute2;
} *n;
I define an array of the above tipe,
n = (struct node *) calloc (666,(sizeof (struct node)));
The question...
Hy everyone,
first a question: I have a C file where the WinMain function resides, and where on the WM_COMMAND case I handle menu options. As an example on IDM_FILE_NEW I launch a dialog box from where I get some input which I convert to numeric variables. The dialog function I've wrote in a...
For bigger numbers you may get an over or underflow so you have to use some bignum library. Hope it will help.
#include <stdio.h>
#include <math.h>
int main (void)
{
int i;
double InvSquare,InvCube,InvQuatric;
for (i=1; i<100; i++)
{
InvSquare = 1./(i*i);
InvCube = 1./(i*i*i)...
I think you can try a combination between fgets to read a line from your source file, alter the line as your wish and after that use puts to write the line in your destination file.
Hope it will help
I have a dialog with an edit box written in C (à la Petzold). What I read from the edit box with GetDlgItemText function I convert to a double with an expression like:
kk = strtod(szText,&rpt);
Then I want to pass the variable kk to a MessageBox,
so I use
wsprintf(szBuffer,TEXT("Your...
There is no such thing like “the best book”. Each book gives you something and you must filter the information on your own taste and capabilities. You must read all you can put hand on. A (free) point to start is the C tutorials on the web.
Let’s say that I have a variable
char filename[12] = "xxxxxxxx.xxx";
and a function who opens a file.
void OpenFile( char *fname)
{
FILE *f;
f = fopen(fname,"w");
if( f == NULL )
{
printf( "File could not be opened\n" )...
Please can anyone help with suggestions about how to define a Boolean data type in C?
For my logical tests now I use one integer and if the condition is TRUE the integer takes value 1
and if FALSE the integer gets 0. But that's rather complicated.
If anyone has a simpler way please let me...
Hy,<br>please can anyone tell me how to write a function that returns an array. I mean when writing a function like<br><br>return_type funct_name ( arg_type arg1, ....)<br>{}<br><br>the return_type should be an array (of double maybe).
If i have a structure like :<br><br>struct node {<br> double x,y;<br> } *n;<br><br>i would like to code a routine, called from main program, who reads the two components of the structure.<br><br>void ReadStruct( ? ? ? ? ? ...
I've written a code in C that performs several computations at various time steps. I want to save the results for each time step in a file. So if anybody can help me, how to change a float type number (the time value ex. 10.25) into a string so i can strcpy it into the file name.<br>ThankYou
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.