Skip to content
Snippets Groups Projects
Commit 2c9c4aab authored by Lucas Christesen Ahler's avatar Lucas Christesen Ahler
Browse files

Debug exercise

parent db7fd411
No related branches found
No related tags found
No related merge requests found
CFLAGS = -o -w -std=gnu99
CFLAGS += `/usr/bin/gsl-config --cflags`
LDLIBS += $(shell /usr/bin/gsl-config --libs)
all: output ; cat $<
output: main ; ./$< > ./$@
clean: ; $(RM) main output
.PHONEY: test
test:
echo $(CFLAGS)
#include"stdio.h"
#include"gsl/gsl_matrix.h"
int print_half_00(gsl_matrix* m)
{
double half = 1.0/2;
int status = printf( "half m_{00} = %g\n", gsl_matrix_get(m,0,0)*half );
//gsl_matrix_free(m);
return status;
}
int main(void)
{
gsl_matrix* m = gsl_matrix_alloc(1,1);
gsl_matrix_set(m,0,0,66);
printf("half m_{00} (should be 33):\n");
int status = print_half_00(m);
if(status==0)
printf("status=%i : SOMETHING WENT TERRIBLY WRONG (status=0)\n",status);
else
printf("status=%i : everything went just fine (status>0)\n",status);
gsl_matrix_free(m);
return 0;
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment