Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 2 (a) Provide a single line of C++ code that will declare a variable that points to a string value, the variable is named
Question 2 (a) Provide a single line of C++ code that will declare a variable that points to a string value, the variable is named x. [2 marks] (b) You have array c declared as string *c [5]; Give the single line of C+ + code that will assign the string pointer stored in variable x (from above) to the third element of the array c. [2 marks] (c) Write a for loop that initialises the contents of each element of the array c to the NULL pointer. [3 marks] (d) You have the following declarations at the start of a function: int i,j; int *nums [3]; int *x; Briefly explain what will happen if the function attempts to execute the state ment: nums [-1] -&j; [3 marks] (e) Are the contents of a pointer checked at compile-time or run-time? Briefly [2 marks] explain your
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started