this is my code:
#include <stdio.h>
#include <conio.h>
#define MAX 10;
int rradhe[MAX];
int koka = -1;
int bishti = -1;
void shto_djathas()
{
int element;
if ((koka == 0 && bishti == MAX -1 )||koka == bishti +1)
{
printf("\nGjendje Overflow");
getch ();int rradhe[MAX];
int koka = -1;
int bishti = -1;
return;
}
if (koka == -1)
{
koka = 0;
bishti = 0;
}
else
if (koka == MAX -1)
bishti = 0;
else
bishti = bishti + 1;
printf ("\n Shtypni elementin qe doni te shtoni ");
scanf ("%d", &element);
}
void main () {
int c;
while(1){
printf("---------------------------");
printf("\nDetyre Kursi - Ivi Hysenbelli , Olsi Lala");
printf("\n 1 - Shtoni element ne rradhe"); // elementet do te shtohen nga e djatha
printf("\n 2 - Hiq element nga e djatha(Nga fillimi)");
printf("\n 3 - Hiq element nga e majta(Nga fundi)");
printf("\n 4 - Afisho rradhen");
scanf("%d",&c);
switch (c) {
case 1:
shto_djathas();
break;
}
}
}
I cant get why is showing me this error.
the error code is on lines 5. 13. 16. 27 i tried almost everything and read too many forums but i cant get why. this is my first deque in c..im a newbie in c programming and i will really appreciate your help. thanks in advance.
p.s. sorry for my english
Here's your modified code:
#include <stdio.h>
#include <conio.h>
#define MAX 10
int rradhe[MAX];
int koka = -1;
int bishti = -1;
void shto_djathas()
{
int element;
if ((koka == 0 && bishti == MAX -1 )||koka == bishti +1)
{
printf("\nGjendje Overflow");
getch ();int rradhe[MAX];
int koka = -1;
int bishti = -1;
return;
}
if (koka == -1)
{
koka = 0;
bishti = 0;
}
else
if (koka == MAX -1)
bishti = 0;
else
bishti = bishti + 1;
printf ("\n Shtypni elementin qe doni te shtoni ");
scanf ("%d", &element);
}
int main () {
int c;
while(true){
printf("---------------------------");
printf("\nDetyre Kursi - Ivi Hysenbelli , Olsi Lala");
printf("\n 1 - Shtoni element ne rradhe"); // elementet do te shtohen nga e djatha
printf("\n 2 - Hiq element nga e djatha(Nga fillimi)");
printf("\n 3 - Hiq element nga e majta(Nga fundi)");
printf("\n 4 - Afisho rradhen");
scanf("%d",&c);
if (c == 1)
shto_djathas();
}
return 0;
}