Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. a) Declare a variable of type int and initialize to 3. b) Declare a variable

ID: 3540643 • Letter: 1

Question

1.

a) Declare a variable of type int and initialize to 3.

b) Declare a variable that stores an array of ints of size 5 and initialize it to the integer 1 to 5

c) Provide the prototype of a function called foo that takes two arguments, an integer and a reference to an integer, and does not return any value.

d) In one sentence describe the c-string datatype

e) what is special about arrays when you pass them to a function?

2

a) What is the type of the following expressing: new string

b) Define a structure called hello with two members - a (c++) string, and a cstring. You can name the members anything you like.

c) In one Sentence , what is the lifetime of dynamically allocated data?

d) Write an expression that dynamically allocates an array of c-strings. The array should have size 5.

e) Suppose the variable s is a pointer to a structure. Without using "->", write an expression that accesses the member called "address" of the structure pointed to by s.

Explanation / Answer

a) int x=3;

b)int x={1,2,3,4,5};

c)void foo( int x, int );

d)there is no datype as string but we use string as char data type

e)we can pass array pointer also

exaple void myArray(int a[]) and void myArray(int *a) both aren same.




a)String

b)

c) =

procedure activation time

d)

e)s.address


Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at drjack9650@gmail.com
Chat Now And Get Quote