Provide the output for the given C++ code about pointers

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter2: Problem Solving Using C++using
Section: Chapter Questions
Problem 1PP: (General math) a. Design, write, compile, and run a C++ program that calculates and displays the...
icon
Related questions
Question

Do 8th question.

 

Q7. Provide the output for the given C++ code about declarations

#include <iostream>
using namespace std;
void addprint()
{
static int s = 1;
s++;
cout << s;
}
int main()
{
addprint();
addprint();
addprint();
return 0;
}

 

 

Q8. Provide the output for the given C++ code about pointers

#include <iostream>
using namespace std;
int main()
{
char arr[20];
int i;
for(i = 0; i < 10; i++)
*(arr + i) = 65 + i;
*(arr + i) = '\0';
cout << arr;
return(0);
}

Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning