EBK DATA STRUCTURES AND ALGORITHMS IN C
EBK DATA STRUCTURES AND ALGORITHMS IN C
4th Edition
ISBN: 9781285415017
Author: DROZDEK
Publisher: YUZU
bartleby

Concept explainers

Question
Book Icon
Chapter 1, Problem 2E
Program Plan Intro

Pointers:

  • A variable whose value is another variable’s address is termed as pointer.
  • A pointer is to be declared before being used.
  • The declaration syntax for a variable that is a pointer is shown below:

    type *lvarname;

  • Here, “type is a pointer's base type and “lvarname is pointer variable’s name.
  • The asterisk sign is been used for pointer declaration.
  • The asterisk sign is being used for designation of a variable as a pointer.

Explanation of Solution

b.

Identification of errors:

Before copying “s2” to “s1”, memory has to be allocated for accommodating contents of “s1”, as shown below:

...

Explanation of Solution

c.

Identification of errors:

While memory allocation for contents of “s2” is performed, one more character has to be allocated for the end-of-string character. In the given syntax, one more character allocation is needed...

Blurred answer
Students have asked these similar questions
#include using namespace std; int find(int arr[], int value, int left, int right) { int midpt = (left+right)/2; if (left > right) return -1; if ( arr[midpt] return midpt; else if (arr[midpt] < value) == value) return else return find(arr,value, left,midpt-1); } void main(void) { int arr[] ={4,5,6,9,11}; cout<
#include <stdio.h>int main(){int d;int s[20],i, r, p, lg=0,m;char c;printf("Enter number of salesman(max 20): ");scanf("%d", &d);for(i=0; i<d; i++){ printf("\n salesman %d sales: ");scanf("%d", &s[i]);}for(i=0; i<d; i++){for(r=i+1; j<d; r++){if(s[i] > s[r]){p= s[i];s[i] = s[r];s[j] = p;}}}printf("\nsalesman lowest to highest: ");for(i=0; i<d; i++){printf("%d\t", s[i]);}for(i=0;i<m;i++){printf("\n highest sales: %d ",lg);if(lg<=s[i])lg=s[i];break;}getch();} >>> the upper part output should be like this  enter number of salesman (max 20): 5 salesman 1     500 salesman 2    300 salesman 3     1000 salesman 4    200 salesman 5    1000   in the lower part the lowest to highest the output should become like this salesman 4     200 salesman 2    300 salesman 1     500 salesman 3    1000 salesman 5    1000  highest total sales : 2000
c++ coding language   I need help with part B and C please. If you are unable to do both, then PLEASE prioritize part C. I am really stuck and really can use the help.       This is the code for c that was provided in order to guide me: const int N =31;    // N parking spaces bool parking[N];   // the garage   void EmptyTheLot(bool parking[], int N) {    for(int i=0; i<N; i++) p[i]=false;       // empty space }   // returns -1 if no space found,  //otherwise it returns   0<=i<N for a valid space.  int FindSpace(int PlateNumber, bool parking[], int N) {       // ?????                                    }    main() {  EmptyTheLot(parking, N);    // start with an empty parking garage. // get plate numbers and fill lot.  }
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education