Starting Out with C++ from Control Structures to Objects (9th Edition)
Starting Out with C++ from Control Structures to Objects (9th Edition)
9th Edition
ISBN: 9780134498379
Author: Tony Gaddis
Publisher: PEARSON
bartleby

Videos

Expert Solution & Answer
Book Icon
Chapter 6, Problem 8RQE

Explanation of Solution

Static local variable:

The variable which is declared inside the function with the keyword “static” is referred to as static local variables.

  • The declaration of the static variable is same as the normal variable declaration, but it should be preceded with the “static” keyword in front the variable.
  • A program can have multiple static local variables in different functions.

Syntax for declaring static local variable:

Static datatype variable_name;

Example:

static int a=10;

Usage of static local variable:

The uses of static local variable are:

  • It makes the function to maintain the value between the function calls.
  • When a function returns, the static variables used in the function are not destroyed.

Example program:

The following example program demonstrates the usage of static local variable.

/*Include required variables*/

#include<iostream>

using namespace std;

/*Function prototype*/

void display();

/*Main function*/

int main()

{

/*Loop till "count" variable is less than "10"*/

for (int count = 0; count < 10; count++)//Line 6

/*Call the function "display()"*/

display();

/*Return the value 0*/

return 0;

}

/*Function definition*/

void display()

{

/*Variable "number" is declared as static "int" and assign "20" to it*...

Blurred answer
Students have asked these similar questions
1. Level the resources (R) for the following network. Show exactly which activity is being moved at each cycle and how many days it is being moved. Show all cycles required to utilize the free float and the back float. B H 3 3 L 2 0-0-0 A C F G K N P Q T 0 3 2 2 1 2-2-2 7R 8R 4R 6R 4R 2R 5R 4R D 1 2R 2 M 000 4R 2 4R 1 2 3 4 B5 B BE B 5 5 7 D 2003 C NO C MBSCM В H 5 2 F 7 7 8 SH2F80 5 Н Н 6 7 7L3G4+ 6H2G4 J 4 4 14 8 L K 00 36 9 10 11 12 13 14 15 P 2 Z+ N N 4 4 Z t 2334 4 Σ + M M 4 +
2. Perform resource allocation for the following project. Resource limits are 6 labors and 2 helpers. Legend: Activity Dur Resources G H 2 3 2L 1H 2L OH A 1 3L 1H + B D F J K 3 4 6 2 4 4L 2H 3L OH 4L 1H 2L 2H 4L 2H C E 2 2 I 1 2L 1H 3L 1H 5L 1H
Need Java method please. Thank you.

Chapter 6 Solutions

Starting Out with C++ from Control Structures to Objects (9th Edition)

Chapter 6.9, Problem 6.11CPChapter 6.9, Problem 6.12CPChapter 6.9, Problem 6.13CPChapter 6.9, Problem 6.14CPChapter 6.9, Problem 6.15CPChapter 6.11, Problem 6.16CPChapter 6.11, Problem 6.17CPChapter 6.11, Problem 6.18CPChapter 6.13, Problem 6.19CPChapter 6.13, Problem 6.20CPChapter 6.13, Problem 6.21CPChapter 6.13, Problem 6.22CPChapter 6.13, Problem 6.23CPChapter 6.15, Problem 6.24CPChapter 6.15, Problem 6.25CPChapter 6, Problem 1RQEChapter 6, Problem 2RQEChapter 6, Problem 3RQEChapter 6, Problem 4RQEChapter 6, Problem 5RQEChapter 6, Problem 6RQEChapter 6, Problem 7RQEChapter 6, Problem 8RQEChapter 6, Problem 9RQEChapter 6, Problem 10RQEChapter 6, Problem 11RQEChapter 6, Problem 12RQEChapter 6, Problem 13RQEChapter 6, Problem 14RQEChapter 6, Problem 15RQEChapter 6, Problem 16RQEChapter 6, Problem 17RQEChapter 6, Problem 18RQEChapter 6, Problem 19RQEChapter 6, Problem 20RQEChapter 6, Problem 21RQEChapter 6, Problem 22RQEChapter 6, Problem 23RQEChapter 6, Problem 24RQEChapter 6, Problem 25RQEChapter 6, Problem 26RQEChapter 6, Problem 27RQEChapter 6, Problem 28RQEChapter 6, Problem 29RQEChapter 6, Problem 30RQEChapter 6, Problem 31RQEChapter 6, Problem 32RQEChapter 6, Problem 33RQEChapter 6, Problem 34RQEChapter 6, Problem 35RQEChapter 6, Problem 36RQEChapter 6, Problem 37RQEChapter 6, Problem 38RQEChapter 6, Problem 39RQEChapter 6, Problem 40RQEChapter 6, Problem 41RQEChapter 6, Problem 42RQEChapter 6, Problem 43RQEChapter 6, Problem 44RQEChapter 6, Problem 45RQEChapter 6, Problem 46RQEChapter 6, Problem 47RQEChapter 6, Problem 48RQEChapter 6, Problem 49RQEChapter 6, Problem 50RQEChapter 6, Problem 51RQEChapter 6, Problem 52RQEChapter 6, Problem 53RQEChapter 6, Problem 54RQEChapter 6, Problem 55RQEChapter 6, Problem 56RQEChapter 6, Problem 57RQEChapter 6, Problem 58RQEChapter 6, Problem 59RQEChapter 6, Problem 60RQEChapter 6, Problem 1PCChapter 6, Problem 2PCChapter 6, Problem 3PCChapter 6, Problem 4PCChapter 6, Problem 5PCChapter 6, Problem 6PCChapter 6, Problem 7PCChapter 6, Problem 8PCChapter 6, Problem 9PCChapter 6, Problem 10PCChapter 6, Problem 11PCChapter 6, Problem 12PCChapter 6, Problem 13PCChapter 6, Problem 14PCChapter 6, Problem 15PCChapter 6, Problem 16PCChapter 6, Problem 17PCChapter 6, Problem 18PCChapter 6, Problem 19PCChapter 6, Problem 20PCChapter 6, Problem 21PCChapter 6, Problem 22PCChapter 6, Problem 23PCChapter 6, Problem 24PCChapter 6, Problem 25PC
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
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:9781305503922
Author:Patrick M. Carey
Publisher:Cengage Learning
Text book image
CMPTR
Computer Science
ISBN:9781337681872
Author:PINARD
Publisher:Cengage
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage
.2: Function Parameters and Arguments - p5.js Tutorial; Author: The Coding Train;https://www.youtube.com/watch?v=zkc417YapfE;License: Standard Youtube License