---
# System prepended metadata

title: Untitled

---

```c

typedef struct food_item {
  char name[30]; // name of the food
  int calPerServing; // number of calories per serving
  int numServings; // number of servings per container
} foodItem_t, *foodItemPtr_t;

typedef struct stack_type {
  foodItem_t stack[50]; // the array of food items
  int top; // top of stack pointer
  int size; // the number of food items on the stack
} stack_t, *stackPtr_t;


static void terminate(const char *message, int exitCode)
  //displays message and terminates application

stackPtr_t create(){
  stack_t stackStructA = {stackPtr_t->stack = stackA, stackPtr_t->top = 0,         stackPtr_t->size = 0};
  stackPtr_t = &stackStructA;
  return(&stackPtr_t);
}

void push(stackPtr_t S, foodItem_t item){
    
}
    
    
//NICK
stackPtr_t create(){ //pointer to the structure stack_type
int i;
for (int i = 0; i < 50; i++){ //creates enough space for all food items
    *foodItemPtr_r stack[i] = malloc(sizeof(food_item));
    if stack[i] = NULL{
        terminate()
    }
    return 
}
    
    int len;
    char foodname[30];
    int calpserv;
    int numServ;
    printf("Enter food name: ");
    len = getaline(foodname,30);
    foodname[len - 1] = '\0' //'\n' replaced with '\0'
    srtcpy((*foodItemPtr_r).name[i], foodname);
    printf("Enter calories per serving: ");
    scanf("%d", &calpserv);
    (*foodItemPtr_r).calPerServing = calpserv;
    printf("Enter number of servings: ");
    scanf("%d", &numServ);
    (*foodItemPtr_r).numServings = numServ;
}
if (i >= 50){
    terminate();
}

}

int size(stackPtr_t S){
for (int i = 0; i < top; i++){
    (*S).size++;
}
return size;
}

int my_func(int *ptr){ //parameter is a pointer to an int
    //do stuff
    return &something;
}
int *b; //pointers to integers
int *a;
b = my_func(a)