Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
shtaya
/
IAG0582
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
242afdaa
authored
Feb 08, 2017
by
shtaya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DMA implemented.
parent
72bc16c5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
2 deletions
lab_1/lab1hw.c
lab_1/lab1hw.c
View file @
242afdaa
...
@@ -26,12 +26,39 @@ typedef struct sales
...
@@ -26,12 +26,39 @@ typedef struct sales
}
sales_t
;
}
sales_t
;
void
readFile
(
sales_t
*
);
void
readFile
(
sales_t
*
);
void
dispData
(
sales_t
*
);
void
sortData
(
sales_t
*
);
int
main
(
void
)
int
main
(
void
)
{
{
sales_t
data
[
NFIELD
];
int
i
;
sales_t
*
data
;
sales_t
**
pArray
;
data
=
(
sales_t
*
)
malloc
(
sizeof
(
sales_t
)
*
NFIELD
);
if
(
data
==
NULL
)
{
printf
(
"memory allocation error
\n
"
);
exit
(
EXIT_FAILURE
);
}
pArray
=
(
sales_t
**
)
malloc
(
sizeof
(
sales_t
*
)
*
NFIELD
);
if
(
pArray
==
NULL
)
{
printf
(
"memory allocation error
\n
"
);
exit
(
EXIT_FAILURE
);
}
for
(
i
=
0
;
i
<
NFIELD
;
i
++
)
{
pArray
[
i
]
=
&
data
[
i
];
}
readFile
(
*
pArray
);
dispData
(
*
pArray
);
readFile
(
data
);
sortData
(
*
pArray
);
return
0
;
return
0
;
}
}
...
@@ -60,3 +87,20 @@ void readFile(sales_t *sp)
...
@@ -60,3 +87,20 @@ void readFile(sales_t *sp)
return
;
return
;
}
}
void
dispData
(
sales_t
*
sp
)
{
int
i
;
for
(
i
=
0
;
i
<
100
;
i
++
)
{
printf
(
"%d,%d
\n
"
,
(
sp
+
i
)
->
person_id
,(
sp
+
i
)
->
book_id
);
}
return
;
}
void
sortData
(
sales_t
*
sp
)
{
return
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment