I am not getting any error in the code below but the output is not as desired; that is, when I insert more than 1 values in the array, I only get the first value printed on the screen, rest is followed by 0s.
I am not getting what is wrong with the code, please help me and do consider that I am a beginner, so kindly describe the required steps in detail.
#include<conio.h>
#include<stdio.h>
#include<process.h>
#define max 10
int a[max],front=-1,rear=-1,n;
I apologize for that silly mistake (scanf) but even after correcting it, the problem still persists.
And I do not know, how int main and void main differ from each other and their respective functions,yet.
Can you please read the article about code tags, and edit your first post so that it has them. Use the <> button on the format menu.
int main() is in the c++ standard, it means the program returns an int to the operating system, which is handy for those writing scripts. The other form that is acceptable is int main(int argc, char* argv[]) which allows for command line arguments.
void main() is a hangover from ancient times (pre ANSI C++) particularly with software like Borland Turbo C++ V3.0 , which is apparently and very unfortunately still the standard for the Indian Education Board.