Lab2/Proejct3/Project4
Signed-off-by: Amrit Panesar <apanesar@4195tech.com>
This commit is contained in:
1 parent
b24453a5ba
commit
d4329f2c52
19 files changed
+600
No files matched your search
@@ -0,0 +1,51 @@
|
||||
// Lab2.cpp : Defines the entry point for the console application.
|
||||
//
|
||||
|
||||
#include "Lab2.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <memory.h>
|
||||
#include <conio.h>
|
||||
#include <malloc.h>
|
||||
|
||||
my_basic_structure_1 *pArray[LGBUFSIZE];
|
||||
my_basic_structure_1 *pArray2[REGBUFSIZE];
|
||||
my_basic_structure_1 *mbsPtr;
|
||||
my_basic_structure_1 *mbsPtr2;
|
||||
|
||||
int i, j, k = 0;
|
||||
|
||||
void init() {
|
||||
for (i = 0; i < LGBUFSIZE; i++) {
|
||||
pArray[i] = (my_basic_structure_1*)malloc(sizeof(my_basic_structure_1));
|
||||
memset(pArray[i], '\0', sizeof(my_basic_structure_1));
|
||||
}
|
||||
mbsPtr = (my_basic_structure_1*) malloc(sizeof(my_basic_structure_1) * REGBUFSIZE);
|
||||
mbsPtr2 = mbsPtr;
|
||||
for (i = 0; i < REGBUFSIZE; i++) {
|
||||
memset(mbsPtr2, '\0', sizeof(my_basic_structure_1));
|
||||
mbsPtr2++;
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
init();
|
||||
|
||||
pause();
|
||||
|
||||
cleanup();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void cleanup() {
|
||||
for (i = 0; i < LGBUFSIZE; i++) {
|
||||
free(pArray[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void pause() {
|
||||
printf("\n%s\n", "Press any key to continue. . . ");
|
||||
getch();
|
||||
}
|
||||
Reference in new issue
Block a user