CIS3355: Data Structures

The University of Texas at El Paso

Professor Kirs

 

Strings: Sample Problems and Exercises

 

1.0010   What is a string, and why do we put a NULL character at the end of it?

 

      SEE SOLUTION

 

1.0015   Explain why strings are viewed differently from numeric arrays.

 

      SEE SOLUTION

 

1.0020   Explain how strings are stored differently in RAM than are numeric arrays

 

      SEE SOLUTION

 

1.0040   Explain what the function atoi does and where it is found.

 

      SEE SOLUTION

 

1.0041   Explain what the function ftoi does and where it is found.

 

      SEE SOLUTION

 

1.0050   If I have two strings called mystring1 and mystring2, and two integers called myinteger1 and myinteger2, and I can issue the command  

 

myinteger2 = myinteger1;

 

why can’t I issue the command:  

 

mystring2 = mystring1? 

 

      SEE SOLUTION

 

1.0100   Given:

 

                    char mystring[5];

 

AND we learn that the base address of mystring is 8356. If we were to look in RAM, we would find:

 

 

 

 

 

 

 


If we were to issue the command:

 

                    puts(mystring);

 

what would the output be??

 

      SEE SOLUTION

 

1.0105   Given: char helloarray[] = “hello”; 

 

        Show RAM Storage assuming a base address of 1200

 

      SEE SOLUTION