I am trying to implement the stack with the array! Every time I execute the program, it runs fine but I'm getting a warning because empty character (s) has not been enabled by default this warning is what is? What am I doing? My code is: I am using Dev C ++ IDE In your source code file you have the character with a byte value 0 (character). Who will be invisible in most text editors. The compiler (GCC) is simply telling you that it is ignoring the character - which should not really be in your source code. You can open your file in Hex Editor, find out what the character is and fix it, or delete your source file and copy it with the code you posted here .
contains # lt; Stdio.h & gt; #to & lt include, stdlib.h & gt; # Max 10 inch top = -1; Int AR [Max]; Zero push (int item) {if (top == MAX-1) {printf ("OOps stack overflow: \ n"); Exit (1); } Top = top + 1; Arrival [top] = item; } // Alert Ent popstacks () {if (top == 0) {printf ("already empty pile: \ n"); Exit (1); } Int x = arr [top]; Top = top -1; Return x; } Zero performance () {int i; For (i = top; i> = 0; i--) {printf ("% d", ARR [i]); } Return; } Int peek () {if (top == - 1) {printf ("\ nFree Stack"); Exit (1); } Return arr [top]; } Int main () {int i, value; Printf ("\ n1. Push to Stack"); Printf ("\ n2. Stack from the Stack"); Printf ("\ n3. Display Stack Data"); Printf ("\ n4. Display at the top"); Printf ("\ n5. Skip \ n"); While (1) {printf ("select \ n option:"); Scanf ("% d", & amp; i); Switch (i) {Case 1: {int value; Printf ("Enter a value to push \ n in the stack:"); Scanf ("% d", & amp; value); Push (value); break; } Case 2: {int p = popStack (); Printf ("Element is pop out:% d \ n", p); break; } Case 3: {printf ("Elements are: \ n"); Display (); break; } Case 4: {int p = peek (); Printf ("top position:% d \ n", p); break; } Case 5: {exit (0); } Default: {printf ("Choose an option for \ n operation"); }} 0 return 0; } // Warning
No comments:
Post a Comment