Submitted by Anonymous (not verified) on Sun, 03/10/2013 - 20:17

To help solidify your understanding of this hour's lesson, you are encouraged to answer the quiz questions and finish the exercises provided in the Workshop before you move to the next lesson. The answers and hints to the questions and exercises are given in Appendix E, "Answers to Quiz Questions and Exercises."


    Given a char pointer, ptr_ch, an int pointer, ptr_int, and a float pointer, ptr_flt, how many bytes will be added, respectively, in the following expressions on your machine?
        ptr_ch + 4
        ptr_int + 2
        ptr_flt + 1
        ptr_ch + 12
        ptr_int + 6
        ptr_flt + 3

    If the address held by an int pointer, ptr1, is 0x100A, and the address held by another int pointer, ptr2, is 0x1006, what will you get from the subtraction of ptr1-ptr2?
    Given that the size of the double data type is 8 bytes long, and the current address held by a double pointer variable, ptr_db, is 0x0238, what are the addresses held, respectively, by ptr_db-1 and ptr_db+5?
    Given the following declarations and assignments:

    char ch[] = {`a', `b', `c', `d', `A', `B', `C', `D'};
    char *ptr;
    ptr = &ch[1];

        what do these expressions do separately?

        *(ptr + 3)
        ptr - ch
        *(ptr - 1)
        *ptr = `F'
 

    Given a character string, I like C!, write a program to pass the string to a function that displays the string on the screen.
    Rewrite the program of exercise 1. This time, change the string of I like C! to I love C! by moving a pointer that is initialized with the start address of the string and updating the string with new characters. Then, pass the updated string to the function to display the content of the string on the screen.
    Given a two-dimensional character array, str, that is initialized as

    char str[2][15] = { "You know what,", "C is powerful." };

    write a program to pass the start address of str to a function that prints out the content of the character array.

    Rewrite the program in Listing 16.7. This time, the array of pointers is initialized with the following strings:

    "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", and "Saturday".

 

Related Items

C প্রোগ্রামের Constants ও Variables

Constants and Variables

Constant এর value  কখনোই চেঞ্জ হয় না। অন্যদিকে  variable কে ব্যবহার করা হয় ভিন্ন ভিন্ন ভ্যালু কে দেখানোর জন্য ।

ভালো C প্রোগ্রামিং কিভাবে করবে ?

ক্লাস 24 : তুমি এখন যে গুলি করতে পারো

CLASS 24: What You Can Do Now

You're now in the last chapter of this book. In this lesson you'll learn more about the C language from the following topics:

C Preprocessor এর ব্যবহার ও উপযোগিতা

In Chapter 2, "Writing Your First C Program," you learned how to use the #include preprocessor directive to include C header files. Since then, the #include directive has been used in every program in this book.

C প্রোগ্রামিং ও অ্যাডভান্স File অপারেশন

In last hour's lesson you learned the basics of reading and writing disk data files. In this lesson you'll learn more about communication with disk data files. The main topics discussed in this hour are

    Random access to files
    Reading or writing binary data

C প্রোগ্রামিং ও File অপারেশন

In Chapter 5, "Reading from and Writing to Standard I/O," you learned how to read or write characters through standard input or output. In this lesson you'll learn to read data from or write data to disk files. The following topics are discussed in this lesson: