Of course! I replaced 1025 with strlen(buf) and it works now, thank!
Type: Posts; User: Imara
Of course! I replaced 1025 with strlen(buf) and it works now, thank!
it works now
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[])
{
if (argc < 2)
Hi!
I need my program to give an error instead of shutting down when there is no argument given to main. I don´t understand where I need to check if there is an argument as that is the first...
No worries, I got it :)
My program has to count the amount of times the word given as an argument to main is given by the user. This all worked untill I added the bit where the program has to exit when EOF is the input.
...
Thank you so much! It works now!!
for clarity, my outcome is:
2.00000e+000 4.00000e+000 2.00000e+000
4.00000e+000 4.00000e+000 4.00000e+000
1.00000e+000 1.00000e+000 9.00000e+000
1.00000e+000 1.00000e+000 1.00000e+000...
New and improved code:
void swap (double **p, double **q); /* wissel de pointer waardes om */
double length (double v[], int dim); /*...
I inserted the asserts, but the outcome of the code did not change.
My program once more:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <assert.h>
At first it didn´t finish the program at all. Now it only returns 0´s, while I need the scanned values, but I can´t find anything wrong with the scan or print functions. I´ll check the callocs, u...
I´m sorry, that was actually the part that I already changed whilst waiting for reply, and it still doesn´t work. Here´s the code I have currently
#include <stdio.h>
#include <stdlib.h>...
The scanf part was the bit that was assigned as a task to us, so that should be righ. It scans in as a long e notation, so the scientific 0.0000000e00
I changed the printing part to
for (i = 0; i < num; i++){
for(j = 0; j < dim; j++){
printf("%lf ", w[i][j]);
}
printf("\n");
}
Hi. I´m kinda new to the pointer and multidimensional arrays. I need an input for the number and dimensions of an array. Than scan these and, sort the vectors and print them again. Only, every time I...
I just put in everything u guys said, and it works like a charm, thanks so much!
Hi! I have to make a 2D home plan of my house for an assignment and run the user through all the different rooms, by letting them chose the direction they want to go. As I'm not that far yet, I've...