Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Praktisk programmering og numeriske metoder
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lucas Christesen Ahler
Praktisk programmering og numeriske metoder
Commits
2c9c4aab
Commit
2c9c4aab
authored
4 years ago
by
Lucas Christesen Ahler
Browse files
Options
Downloads
Patches
Plain Diff
Debug exercise
parent
db7fd411
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
exercises/debug/Makefile
+13
-0
13 additions, 0 deletions
exercises/debug/Makefile
exercises/debug/main.c
+24
-0
24 additions, 0 deletions
exercises/debug/main.c
with
37 additions
and
0 deletions
exercises/debug/Makefile
0 → 100644
+
13
−
0
View file @
2c9c4aab
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
)
This diff is collapsed.
Click to expand it.
exercises/debug/main.c
0 → 100644
+
24
−
0
View file @
2c9c4aab
#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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment