Are you not allowed to use the delete[] operator on an array that was dynamically allocated in a function with new?
e.g.,
void func1()
{
...
double *a;
func2(a);
delete[] a;
...
}
void func2(double *a)
{
...
a = new double[N];
...
}
I am confused about this...
I am having a problem with atoi() in this function. It works correctly in Windows, putting a shiftAmount that corresponds to the two digits, but fails under Linux/UNIX where, for example, a 2 and a 3 get made into 20 + 32 = 52 instead of 20 + 3 = 23. What's wrong? Is it because I declared my...
I want to read a block of data from an ifstream into an array of doubles. However, the function .read(char* buffer, int size) does not allow me to put the pointer for the double array into where it requires a char pointer. I don't understand why there is this limitation, or how to get around...
I am trying to pass the array "da" from the non_linear_min function to the lev_mrq_min_step function, have it filled with values, and then return it to add it into another array. The problem is, the "da" array appears to be given proper values from it's assignment in the...
I would like to be able to pass a particular function to another function so that I may call that specific function from within the function it was passed to, i.e.:
double func2(int a,long b,double c);
double *func1(long a,long b,*func2(...))
{
...;
func2(...);
..;
}
How does one go...
Please don't laugh, as I know just how horrible Packard Bells are. However, I want to use my old 486 box to test UNIX and Linux on. The problem is that all of the distributions I want to install are best installed from CDs and this computer does not appear to have the ability to boot from the...
I have written a function to calculate the n-degree polynomial fit of a given data set. I made the function in an external file and linked it to another program with a header file. I want it to do something like this, where a is an array for holding the polynomial coefficients:
//main program...
Okay, I was able to get my program to correctly write the raw value of my variable to the file. I am now trying to make another program to allow me to convert the binary data file to a formatted string file just in case I would like to have the data human-readable. Unfortunately, I am getting...
I would like to write the value of a long double variable to a file, but NOT in a formatted string. I want the raw 8 bytes of the number so I can keep all the precision without writing a 25-30 byte string representing the number. How is this done? Thanks for any help.
I am trying to learn how to program assembly and I am starting on a Linux system with the NASM compiler. I have written an include file for my program that contains macros for system calls, so I can make system calls more conveniently. Unfortunately, I am getting a compiler error at line 3...
I am trying to learn how to program assembly and I am starting on a Linux system with the NASM compiler. I have written an include file for my program that contains macros for system calls, so I can make system calls more conveniently. Unfortunately, I am getting a compiler error at line 3...
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.