answersLogoWhite

0

What is MAXSIZE?

User Avatar

Anonymous

9y ago
Updated: 8/21/2019

MAXSIZE is a C language macro defining the maximum length for all standard library input buffers.

User Avatar

Wiki User

9y ago

What else can I help you with?

Related Questions

C plus plus Defines a constant MaxSize equal to 20 Defines array Data whose base type double MaxSize elements Initializes the array Data so that each element is initialized to the square of its index.?

#define MaxSize (20) double Data[MaxSize]; int i; for (i=0; i<MaxSize; i++) Data[i] = i*i;


C program to implement selection sort?

#include<stdio.h> #include<conio.h> #define MAXSIZE 500 void selection(int elements[], int maxsize); int elements[MAXSIZE],maxsize; int main() { int i; printf("\nHow many elements you want to sort: "); scanf("%d",&maxsize); printf("\nEnter the values one by one: "); for (i = 0; i < maxsize; i++) { printf ("\nEnter element %i :",i); scanf("%d",&elements[i]); } printf("\nArray before sorting:\n"); for (i = 0; i < maxsize; i++) printf("[%i], ",elements[i]); printf ("\n"); selection(elements, maxsize); printf("\nArray after sorting:\n"); for (i = 0; i < maxsize; i++) printf("[%i], ", elements[i]); } void selection(int elements[], int array_size) { int i, j, k; int min, temp; for (i = 0; i < maxsize-1; i++) { min = i; for (j = i+1; j < maxsize; j++) { if (elements[j] < elements[min]) min = j; } temp = elements[i]; elements[i] = elements[min]; elements[min] = temp; } }


Psuedocode of Selection sort in data structure?

fro implementing selection sort yiou have to first find the max or the min value in the array; here you go: for(i=0;i<=maxsize;i++) { min=a[i]; loc=i; for(j=1;j<=maxsize;j++) { if(min>a[j]) { min=a[j]; loc=j; } } if(loc!=i) { temp=a[i]; a[i]=a[loc]; a[loc]=temp; } }


How do you insert the item in queue?

# define maxsize 5 int front=-1,rear=-1; initially set the front=rear=-1 During first insertion, increment front and rear location by counter variable say i ie front++ rear++


How do you create a stack in Turbo Pascal?

In Turbo Pascal, you can create a stack by defining a dynamic array or a record that holds the stack elements along with a pointer or an index to track the top of the stack. You would typically create procedures for basic stack operations like Push to add an element, Pop to remove the top element, and IsEmpty to check if the stack is empty. Here's a simple example: const MaxSize = 100; type Stack = record items: array[1..MaxSize] of Integer; top: Integer; end; procedure Initialize(var s: Stack); begin s.top := 0; end; procedure Push(var s: Stack; value: Integer); begin if s.top < MaxSize then begin s.top := s.top + 1; s.items[s.top] := value; end; end; function Pop(var s: Stack): Integer; begin if s.top > 0 then begin Pop := s.items[s.top]; s.top := s.top - 1; end; end; function IsEmpty(s: Stack): Boolean; begin IsEmpty := s.top = 0; end; This code initializes a stack, allows pushing and popping of elements, and includes a function to check if the stack is empty.


Real time example of circular queue?

Technically that's a statement, not a question, but check this out http://en.wikipedia.org/wiki/Circular_buffer Basically, any operating system uses these for loading files into. The basic idea is that you have a fixed chunk of memory to work with.


Program of implement queues in an array?

//implement priority queue. #include<stdio.h> #include<conio.h> #include<stdlib.h> #define maxsize 10 void insert(); void delet(); void traverse(); int queue[maxsize]; int item,smallest,loc,i; int front=0; int rear=-1; void main() { int choice; char ch; do { printf("\n 1. insert"); printf("\n 2.delete"); printf("\n 3. traverse"); printf("enter ur choice"); scanf("%d",&choice); switch(choice) { case 1: insert(); break; case 2: delet(); break; case 3: traverse(); break; case 4: exit(1); default:printf("\n entered wrong choice"); } printf("\n do u wish to continue(y/n)"); fflush(stdin); scanf("%c",&ch); } while(ch =='Y' ch == 'y'); getch(); } void insert() { if (rear==maxsize) { printf("\n overflow"); exit(0); } else { printf("enter the element"); scanf("%d",&item); rear=rear + 1; queue[rear]=item; } } void delet() { if(front<0) { printf("underflow"); getch(); exit(0); } else { item=queue[front]; for(i=1;i<=rear;i++) if(item>queue[i]) { loc=i; item=queue[i]; //front=front+1; for(loc=i;loc<=rear;loc++) queue[loc]=queue[loc+1]; front=front+1; rear=rear-1; printf("deleted item=%d",item); } } } void traverse() { int i; for(i=front;i<=rear;i++) { printf("%d",queue[i]); } }


Implement a class stack which simulates the operations of the stack allowing LIFO operationsAlso implement push and pop operations for the stack?

/* C program to implement stack. Stack is a LIFO data strcuture LIFO - Last in First Out Perform PUSH(insert operation), POP(Delete operation) and Display stack */#include #include #define MAXSIZE 5struct stack /* Structure definition for stack */{int stk[MAXSIZE];int top;};typedef struct stack STACK;STACK s;/* Function declaration/Prototype*/void push (void);int pop(void);void display (void);void main (){int choice;int option = 1;clrscr ();s.top = -1;printf ("STACK OPERATION\n");while (option){printf ("--------------\n");printf (" 1 -> PUSH \n");printf (" 2 -> POP \n");printf (" 3 -> DISPLAY \n");printf (" 4 -> EXIT \n");printf ("--------------\n");printf ("Enter your choice\n");scanf ("%d", &choice);switch (choice){case 1: push();break;case 2: pop();break;case 3: display();break;case 4: return;}fflush (stdin);printf ("Do you want to continue(Type 0 or 1)?\n");scanf ("%d", &option);}}/*Function to add an element to the stack*/void push (){int num;if (s.top -1){printf ("Stack is empty\n");return;}else{printf ("\nThe status of the stack is\n");for (i = s.top; i >= 0; i-){printf ("%d\n", s.stk[i]);}}printf ("\n");}byankit shukla


Using Fortran, create a program that reads tick data (dat file) of stock prices and outputs one second bars to the screen with an open blank line every second?

! Program to read tick data (dat file) of stock prices and output one second bars to the screen with an open blank line every second. program one_second_bar implicit none ! Declare the variables integer, parameter :: maxSize = 30000 ! Maximum size of dat file integer :: n, i, time_read ! n: number of elements in dat file ; i: loop index ; time_read: time of the last read element real, dimension(maxSize) :: stock_price ! Array to store stock prices real :: open_price, high_price, low_price, close_price ! variables to store open, high, low, close prices ! Read the data file and store data into array open(unit=10, file='stock_price.dat') read(10, *) n do i = 1, n read(10, *) stock_price(i) end do close(10) ! Iterate through the array and calculate open, high, low and close prices time_read = 0 open_price = stock_price(1) high_price = stock_price(1) low_price = stock_price(1) do i = 2, n if (i > time_read + 1) then write(*,*) 'Open: ', open_price, ' High: ', high_price, ' Low: ', low_price, ' Close: ', close_price write(*,*) time_read = i open_price = stock_price(i) high_price = stock_price(i) low_price = stock_price(i) else if (stock_price(i) > high_price) then high_price = stock_price(i) else if (stock_price(i) < low_price) then low_price = stock_price(i) end if end if end do ! Output the last bar close_price = stock_price(n) write(,) 'Open: ', open_price, ' High: ', high_price, ' Low: ', low_price, ' Close: ', close_price end program one_second_bar


What is a Menu driven program for a stack operation?

#include#include#include#define MAXSIZE 50int a[MAXSIZE];int top=-1;void main(){int choice;void push();int pop();void display();clrscr();do{printf("\nYou can do following operations on stack\n");printf("\n1. Push");printf("\n2. Pop");printf("\n3. Display");printf("\n4. Exit");printf("\n Enter your choice");scanf("%d",&choice);switch(choice){case 1: push();break;case 2: pop();break;case 3: display();break;case 4: break;default: printf("\n Wrong input");}}while(choice!=4);getch();}void push(){int value;if(top==MAXSIZE-1){printf("\n Stack is overflow");}else{printf("\n Enter the value which you want to insert");scanf("%d",&value);top++;a[top]=value;}}int pop(){int value;if(top==-1){printf("\nStack is underflow");return(0);}else{value=a[top];top--;}return value;}void display(){int i;if(top==-1){printf("\n Stack is underflow");}else{for(i=top;i>=0;i--){printf("\n%d",a[i]);}}}#include < stdio.h >#include < conio.h >#define MAX 10int stack[MAX],top;void main(){char ch;int choice,item;void display();int pop();void push(int);clrscr();top=-1;do{printf("1.Insertion");printf("\n2.Deletion");printf("\n3.Display");printf("\nEnter your choice(1-3):");scanf("%d",&choice);switch(choice){case 1: printf("\nEnter the item to be inserted:");scanf("%d",&item);push(item);display();break;case 2: item=pop();printf("\nThe item deleted is %d",item);display();break;case 3: display();break;default:printf("Wrong choice");break;}printf("\nDo you want to continue(y/n):");fflush(stdin);scanf("%c",&ch);}while(ch=='y' ch=='Y');getch();}void push(int item){if(top==MAX-1){printf("Stack Overflow");return;}top=top+1;stack[top]=item;}int pop(){int t;if(top==-1){printf("Stack Underflow");return -1;}t=stack[top];top=top-1;return t;}void display(){int i;printf("\nThe Stack elements are:");for(i=0;i < =top;i++)printf("%5d",stack[i]);}


What is the stack algorithm to push an item?

Stack Data Structure1.It is a Linear Data Structure.2.In which a data item is inserted & deleted at one end.3.It is a Last In - First Out (LIFO) Data Structure where the data item is inserted last into the stack is the first data item to be deleted from the stack.NOTE:Please refer to http://www.cosc.canterbury.ac.nz/mukundan/dsal/StackAppl.html site to understand the concept of stack using java applet.Just Copy & Paste it in your browser,but you need a Java RunTime Environment(JRE) installed onto your PC.4.Writting a value to stack is push operation.5.Reading a value from the stack is pop operation.6.Once an item is popped from the stack,it is no longer available.Algorithm1.push operation:if top of the stack is greater than equal to maximum number of entries into the stack,then print "Stack is already full.Cannot add more items."top of stack = tincrement the top of the stack2.pop operation:decrement top of the stackif top


Program for stop and wait protocol in c language?

/*************************************************************************************/ /* C program to implement stop and wait protocol*/ /* Download more programs at http://sourcecode4u.com/ */ /*************************************************************************************/ #include&lt;stdio.h&gt; #include&lt;conio.h&gt; #define MAXSIZE 100 typedef struct { unsigned char data[MAXSIZE]; }packet; typedef enum{data,ack}frame_kind; typedef struct { frame_kind kind; int sq_no; int ack; packet info; }frame; typedef enum{frame_arrival}event_type; typedef enum{true_false}boolean; void frame_network_layer(packet *p) { printf("\n from network arrival"); } void to_physical_layer(frame *f) { printf("\n to physical layer"); } void wait_for_event(event_type *e) { printf("\n waiting for event n"); } void sender(void) { frame s; packet buffer; event_type event; printf("\n ***SENDER***"); frame_network_layer(&amp;buffer); s.info=buffer; to_physical_layer(&amp;s); wait_for_event(&amp;event); } void from_physical_layer(frame *f) { printf("from physical layer"); } void to_network_layer(packet *p) { printf("\n to network layer"); } void receiver(void) { frame r,s; event_type event; printf("\n ***RECEIVER***"); wait_for_event(&amp;event); from_physical_layer(&amp;r); to_network_layer(&amp;r.info); to_physical_layer(&amp;s); } main() { sender(); receiver(); getch(); }