Write the output of the following programme according to static and dynamic scope rules. int x; void yaz () { printf("%d ",x);} void k1 () { int x=1; yaz (); k2 (); } void k2 () { int x=2; yaz (); } int main() { x=0; yaz (); k1(); k2 (); }
Added by Bego-A S.
Step 1
Step 1: In the main function, x is initialized to 0. Show more…
Show all steps
Your feedback will help us improve your experience
Akash M and 59 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
What is the output of the following program? #include int main() int arr [5] = {1, 2, 3, 4, 5); arr [1] = 0; arr [3] = 0; for int i = 0; . < 5; -+1) printf ("d", ar 21); return 0;
Akash M.
Write a program in C++ to do the following: (1) Declare an array 'a' of size 10 and three pointer variables 'p', 'q', and 'v'. (2) Write a loop to fill array 'a' with values 10, 20, 30, 40, 50, 60, 70, 80, 90, 100. (3) Write the following statement: p = &a[2]; q = &a[5]; int i = *q - *p; cout << "The value of i is " << i; i = *p - *q; cout << "The value of i is " << i; (4) Assign the address of 'a' to 'v'. (5) Write a loop to print the values of array 'a' using pointer variable 'v'.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD