I don't know, I need to do some mathematical calculations in my project and I'm just debugging right now so that's why I'm using assertions.
Type: Posts; User: broli86
I don't know, I need to do some mathematical calculations in my project and I'm just debugging right now so that's why I'm using assertions.
trying to store a value at a NULL address may result in undefined behaviour. I think before the assignment takes place using an assert statement may be helpful :
assert(vector_iterator(&v, axis)...
I understand what you are saying. I actually got this warning in many other programs when there was no return value specified at the end of the function. What is the solution or can I ignore this...
#include <stdio.h>
typedef struct
{
double x, y, z;
}vector;
double *vector_iterator(vector *v, int axis)
{
Initializing as in intiializing the members of edr. I intend to use only one ray variable and change the value of the members of the variable everytime I want to trace a new ray rather than use an...
Hello I need some ideas for designing a recursive function for my ray
tracing program.
The idea behind ray tracing is to follow the electromagnetic rays from
the source, as they hit the...
from what i hear, realloc cannot be used to downsize the array.
although i have seen it happen quite often.
yes, i realised that error.
#include <stdio.h>
#include <stdlib.h>
typedef struct node_s
{
void *data;
They print actual values correctly.
I'm using digital mars compiler and used the -a option(strict ansi c/c++) and got no warnings or errors.
I changed my program to the following and its working perfectly well :
#include <stdio.h>
#include <stdlib.h>
typedef struct node_s
{
#include <stdio.h>
#include <stdlib.h>
typedef struct node_s
{
void *data;
struct node_s *next;
}node;
sorry, i realized it now and fixed it. It was a silly mistake. Unfotunately, my pelles C compiler never reports such dangerous situations. Can you please tell me of some easy to use debugger in...
Hi, I'm trying to deallocate a kd tree which I created dynamically. There were no problems creating the structure and I can access it easily but there is a problem while trying to free
it. Here's...
I have seen people saying fgets is safer to use than gets and it avoids buffer overflow. I want to ask how. code :
int getstring(char *s, size_t n, FILE *fp)
{
char *p = NULL;
...
One part in this code that's not clear to me is that you did not check for initial white space. It is possible that there may be some white space before the actual data begins. The rest I think you...
Hi I've a string input and I have to parse it in such a way that that there can be only white space till a digit is reached and once a digit is reached, there can be only digits or white space till...
Thanks for that idea. I also have to take care of division overflow i.e. a/b > DBL_MAX. I'm not sure if loss of precission will be an issue since I'm using double data type.
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <math.h>
#include <string.h>
int string_to_double(char *s, char **endptr, double *f)
{
int too_big = 0;
The endptr pointer (if not passed as NULL) will point to the start of the input string if no conversion was done. If any characters were used, it will be advanced. That's why I checked for :
...
Ok I changed my code , please have a look :
int main(void)
{
char s[50], *ptr = NULL;
char *endptr1, *endptr2, *endptr3;
double f1, f2, f3;
int too_big = 0;
I don't think subt_chk is needed because add_chk can take care of it. I have to implement mul_chk and make div_chk more elaborate as to how it should deal with :
INT_MIN/ -1 , 0/0 inf/0 etc etc
Ok , I appologize.
#include <stdio.h>
int main(void)
{
int i;
int j;
j = 0;
for (i = 1; i <= 40; i++)
{
As you can see the first double value in the string i.e. 123.4444e-309 should cause underflow yet i am getting 0.000000 33.4444 -10.555 as the output. The too_small remains 0 . Have I made a mistake...
Well I would have used assert, but I don't really want to exit on all situations. Only some fatal error situations like memory allocation failure.