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
String Pair   // Problem Description   // One person hands over the list of digits to Mr. String, But Mr. String understands only strings. Within strings also he understands only vowels. Mr. String needs your help to find the total number of pairs which add up to a certain digit D.       // The rules to calculate digit D are as follow       // Take all digits and convert them into their textual representation       // Next, sum up the number of vowels i.e. {a, e, i, o, u} from all textual representation       // This sum is digit D       // Now, once digit D is known find out all unordered pairs of numbers in input whose sum is equal to D. Refer example section for better understanding.       // Constraints   // 1 <= N <= 100       // 1 <= value of each element in second line of input <= 100       // Number 100, if and when it appears in input should be converted to textual representation as hundred and not as one hundred. Hence number…
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