Hello,
I have developed a program that uses two additional libraries not usually found in linux systems. Since I am using my own linux machine, I have root access and can install these in the...
Type: Posts; User: s_siouris
Hello,
I have developed a program that uses two additional libraries not usually found in linux systems. Since I am using my own linux machine, I have root access and can install these in the...
thanks for your reply, I think it was late at night when I posted this and was too tired to think straight... I guess sometimes it happens!
Hi all,
I need to declare a variable that is only used in a do-while loop, and my question is where to best declare and initialise it. I have been reading that it is best to declare variables at...
I think I may know the reason:
spiros@lenore:~/programming/cpp.accel.mine$ g++ -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu...
yes, the problem was with "count" I didn't use it properly and was concentrating in the for loop to find my mistake rather than looking at other aspects of the program. I've made some modifications...
Hi all,
I'm working my way through this book and I'm having some trouble in an exercise. It asks to write a program to compute and print quartiles (the quarter of the numbers with largest values)...
after couple of days of fiddling with the code, I found out that I was trying to read out of bounds of an array on the last iteration inside a loop.... That's a silly mistake that I shouldn't have...
Thanks Elysia,
The way I'm allocating 2d arrays is this:
arr2d=malloc(rows*sizeof(*arr2d));
if (arr2d==NULL) {
printf("Could not allocate data array of size...
Hi all,
Can you please point out to me how can I correctly pass a 2d dynamically allocated array into a function? My problem is that I cannot know the size of the two dimensions beforehand, and I...
understood, cheers guys!
Hi all,
I've been debuging a code for almost two weeks now and I found that the problem was the in a fscanf/sscanf statement I used %i instead of %d...
Can someone please explain to me what is...
thanks for your replies.
I improved the code, by initializing all members of the tm structure, and valgrind now shows no errors, but I'm still getting the same behavior at random points in my...
Hello!
I'm sort of a beginner as well, but can see what is your problem. You correctly initialize the num values with zero. and then:
num3 = num1 + num2
which means that num3 holds the value of...
Hi all,
I'm writing a program to read some experimental data from a file, then do some manipulations, and then to write the new data into another file. The program works ok, but after a few...
that's brilliant guys, i've understood what was wrong. Thanks a lot for the explanations of the outputs of sizeof(buff[i]), and sizeof(*buff[i]).
many thanks
Spiros
Hi all,
I'm' writing a program in which I can't get round to see what I am doing wrong in a small part of it that deals with:
-dynamically allocating a 1d string array (or 2d char array..)...
I'm now having another problem with how much memory is allocated
double *vec_y;
unsigned int nrows;
vec_y = malloc(nrows*sizeof(*vec_y));
for (i=0; i<nrows;...
I'm just trying to learn by trying different things. Unfortunately the books I've borrowed from my library are not very clear and therefore things in my head are not clear as well, but fortunately...
thanks cas, I'm now trying to get my head round what you've posted... pointers are a pain!
As for the loop going over the columns, that's my mistake being too quick, it should go over "rows"
...
is it posible to use
const int SIZE = 10;
int *vector;
vector = malloc(SIZE*sizeof(vector));
instead of
const int SIZE = 10;
int *vector;
vector = malloc(SIZE*sizeof(int));?
Hi all,
I 'm having a bit of trouble understanding about the use of malloc for 1d and 2d arrays., and I would appreciate if someone could tell me what is correct. Lets say for 1d arrays, which is...
ah yes, it's very clear now
thank you!
thank you for your replies, it works now.
Can you please explain to me why do I need to call read_data using "data", wheras in the declaration of read_data it's "**data"?
Hi all,
I'm writing a program where I am allocating a 2d array dynamically (ie using malloc), and then I want to pass this array to a function, but I'm not being successful...
Here are the...
it works!
I've split the cout statement into two as you suggested and it worked. Thanks so much, it would've taken me donkeys years to figure this out on my own...
cheers!