Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PROG-material-public
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
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
Walter, Wolfgang
PROG-material-public
Commits
0c2d48b9
Commit
0c2d48b9
authored
1 year ago
by
Jonas Riedel
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
4ba80bed
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Uebung/SoSe24/PointerUebungEmpty.f95
+88
-0
88 additions, 0 deletions
Uebung/SoSe24/PointerUebungEmpty.f95
with
88 additions
and
0 deletions
Uebung/SoSe24/PointerUebungEmpty.f95
0 → 100644
+
88
−
0
View file @
0c2d48b9
program
pointer_exercise
implicit
none
! Declare variables
integer
,
target
::
a
=
5
integer
,
pointer
::
ptr
! Point ptr to variable a
! Modify the value of a using ptr
! Print the modified value of a
write
(
*
,
*
)
"The modified value of a is:"
,
a
end
program
pointer_exercise
program
pointer_exercise_2
implicit
none
type
ListElement
integer
::
element
type
(
ListElement
),
pointer
::
next
=>
null
()
end
type
ListElement
type
List
type
(
ListElement
),
pointer
::
head
=>
null
()
end
type
List
type
(
List
)::
myList
!Allocate storage for the first (head) element of the list
!Insert the number 1 as the first (head) element of the list
!Allocate storage for the second element of the list
!Insert the number 2 as the second element of the list
!Write the first and second element of the list
!Deallocate the second element of the list
!Verify that there is no second element in the list using associated()
!Try writing the first and second element of the list again
!Try writing a hypthetical third element of the list
!Deallocate the first element of the list
end
program
pointer_exercise_2
program
pointer_exercise_3
implicit
none
type
ListElement
integer
::
element
type
(
ListElement
),
pointer
::
next
=>
null
()
end
type
ListElement
type
List
type
(
ListElement
),
pointer
::
head
=>
null
()
end
type
List
type
(
List
)
::
myList
type
(
ListElement
),
pointer
::
current
integer
::
input
allocate
(
myList
%
head
)
write
(
*
,
*
)
"Please enter the integer of the first element of the List:"
read
(
*
,
*
)
myList
%
head
%
element
current
=>
myList
%
head
!Write a do loop that inserts new integers given by the user into the List until the user inputs a negative number.
!Use the pointer "current" and the integer "input"
end
program
pointer_exercise_3
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