So I decided to give up on chars and strings until I understand how they work in C a little bit better but the program itself is working. I simply changed the chars to integers.
Even though the program is not complete it works!
Thank you, anduril462!
If someone is curious though here is the working code:
Code:
/*
learning.c
05-18-2012
Layvian
-----------
The purpose of this program is to store
character values into memory using pointers.
*/
#include <stdio.h>
#include <stdbool.h>
void lifeState(void);
void learnStorage(int status, int *pStatus);
void responseIn(int *pMemSlot1, int *pMemSlot2);
void responseOut(int memSlot1, int memSlot2);
int main(){
lifeState();
return 0;
}
/*
Life State Function
While this function is in the Loop the program
will continiue to store char values in memory.
Once ended the life state will end displaying
the output of the two stored values and their
address.
*/
void lifeState(void){
int status = 1;
int *pStatus;
pStatus = &status;
do{
learnStorage(status, pStatus);
}while(status == 1);
printf("End\n");
}
//Learn Storage Function
void learnStorage(int status, int *pStatus){
/*
MEMORY SLOT 1
Created with two types:
1. Character
2. Boolean
Each has a pointer that references the originals
address. Once the variable slot contains a char,
it will be entered into the IF logic to switch the
FALSE status of the "memSlot1Full", to TRUE.
*/
int memSlot1;
int *pMemSlot1;
pMemSlot1 = &memSlot1;
_Bool memSlot1Full = false;
_Bool *pMemSlot1Full;
pMemSlot1Full = &memSlot1Full;
/*
MEMORY SLOT 2
Created with two types:
1. Character
2. Boolean
Each has a pointer that references the originals
address. Once the variable slot contains a char,
it will be entered into the IF logic to switch the
FALSE status of the "memSlot2Full", to TRUE.
*/
int memSlot2;
int *pMemSlot2;
pMemSlot2 = &memSlot2;
_Bool memSlot2Full = false;
_Bool *pMemSlot2Full;
pMemSlot2Full = &memSlot2Full;
responseIn(pMemSlot1, pMemSlot2);
printf("%d\n", memSlot1);
*pStatus = 0;
}
//Response Out Function
//Response In Function
void responseIn(int *pMemSlot1, int *pMemSlot2){
int responseOne = 12;
int responseTwo = 50;
*pMemSlot1 = responseOne;
*pMemSlot2 = responseTwo;
}
//Response Out Function
void reponseOut(int memSlot1, int memSlot2){
}