I'm quite to programming and I don't uderstand why my program doesn't build. I don't know where exactly is the problem. To me it seems it should work. These are mostly examples i've found on the internet.
There's some code: Main:
#include <stdlib.h>
#include <stdio.h>
#include "mod.h"
int main() {
push(*s, 15);
push(*s, 4);
push(*s, 18);
printf("%d",s->data[0]);
system("PAUSE");
return 0
}
Mod.c :
#define DEBUG 0
#include<stdio.h>
#include"mod.h"
//------------------------------------------------------------------------------
void push(struct Stack *s, int value)
{
if (s->size >= MAX_DATA - 1)
{
#if DEBUG
printf("no space.\n");
#endif
}
else
{
s->data[s->size] = value;
s->size++;
#if DEBUG
printf("added.\n");
#endif
}
}
//------------------------------------------------------------------------------
int pop(struct Stack *s)
{
if (s->size > 0)
{
#if DEBUG
printf("poped.\n");
#endif
return s->data[s->size] = 0;
} else {
s->data[s->size] = 0;
s->size--;
}
}
Mod.h :
#include <stdio.h>
#include <stdlib.h>
#ifndef MOD_H_INCLUDED
#define MOD_H_INCLUDED
#define MAX_DATA 30
typedef struct Stack {
int data[MAX_DATA];
int size;
} Stack;
// This function adds element to the end of the structure.
void push(struct Stack *s, int value);
// This function removes element from the end of the structure.
int pop(struct Stack *s);
//int pop(struct Stack *s)
#endif // MOD_H_INCLUDED
Any suggestions why it doesn't build?
Additional data,Additional data,Additional data,Additional data,