Thanks for the quick response but what would be printed?
I just need someone to confirm that I'm using the precedence rules correctly.
printf("%d \n", 2 > !3 && 4 - 1 != 5 || 6);
2 > 0 && 3 !=...
Type: Posts; User: dakarn
Thanks for the quick response but what would be printed?
I just need someone to confirm that I'm using the precedence rules correctly.
printf("%d \n", 2 > !3 && 4 - 1 != 5 || 6);
2 > 0 && 3 !=...
Really quick: Can someone explain in the order in which to read this?
printf("%d \n", 2 > !3 && 4 - 1 != 5 || 6);
Thanks!
Yay fixed using:
for (k=0;k<4;k++) {
printf("a[%d][] = %f %f %f %f\n",k+1,*A[k],*A[k]+1,*A[k]+2,*A[k]+3);
}
My problem now is that it prints values but it prints the wrong values:
Great catch Elysia!
This may be a stupid question but what kind of value is it if not a float?
I switched up my code a little bit but my understanding may be faulty here:
A = (double **)calloc(16, sizeof(double *));
Allocates enough memory for 16 doubles?
for(row=0;row<4;row++)
{...
I'm trying to make my matrix a 4x4 matrix. What's the indication that it's a 16x16 matrix?
I think my program is crapping out because of faulty memory allocation.
I want my code to read matrix.dat and store the numbers in a 4x4 matrix using pointer ........... Then I would like to print...
Not quite sure how this exactly works. Why am I not allocating anything at A[n] and why is there no memory to hold the sscanf data?
This is my altered code:
if ((Inf_1 == NULL))
{
printf("Error opening the file\n");
exit(1);
}
I want my code to read matrix.dat and store the numbers in a 4x4 matrix using pointers. Then I would like to print the matrix line by line. Although my program compiles, I get a core dump error...
this is my modified code (declared prototypes, tried to fix the factorial equation):
#include <stdio.h>
#include <math.h>
double Intgr(double m, int n, double A, double a, double b);...
I'm trying to call multiple functions to calculate an integral on the interval 0 < a < b.
My code compiles and it seems to call up the functions correctly but I get a weird number for an answer....
Problem solved! I defined the variables in the "ugly way" at first but I tried to find a more elegant solution. I tried putting sscanf in the k loop but I didn't know how to stop it from scanning the...
It seems the print only v[0] if I explicitly tell it to print v[0], v[1], v[2] etc
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
int main(){
int k;
Those tips are great. Thank you very much.
My code is compiling but my vectors aren't being stored correctly. This is my output:
iacs5.ucsd.edu% a.out
Original Vector = [2.000000 ]
...
Hi I was wondering if it was possible to store a data file in an array:
The data file (vec_in.dat) would look like this :
1.2 -2.3 0.53 2.01 -1.5
I'm trying to store these 5 numbers in an...
... damn.
I'm trying to create a program that would first read a list from a data file containing names of people and their sales and then calculate the amount of commission each person makes. I'm trying to...
I changed the "case '1'" to a "case 1:" but the output still only prints "unrecognized operator". Any way to circumvent this problem?
Thanks for the indents Salem! I'm coding on putty so I gave up...
Thanks for the input so far guys.
I modified the printfs to include a \n at the end of each one.
Now the problem is that it won't recognize the operator. This is the output:
Enter -1<x<1:...
My switch statement embedded in my do loop doesn't seem to execute correctly:
#include <stdio.h>
#include <math.h>
int main()
{
double x, y, y2;
int n_term;
My program compiles fine in CC but incorrectly in GCC:
#include <stdio.h>
#include <math.h>
int main()
{
double x, i, S;
Thanks for the tip arpsmack!
Now I can compile my code but my output is like this:
Sphere ( 1) Radius = 0.0 Area = 0.000 Volume = 0.000
Sphere ( 2) Radius = 0.0 Area = 0.000...
Can anyone tell me why my C code can't compile:
#include <stdio.h>
#include <math.h>
#define PI = 3.1415926
int main()
{
int k;