Data Modifiers এবং Math Functions এর ব্যবহার

Submitted by administrator on Mon, 01/02/2012 - 15:41

Chapter 09 - Playing with Data Modifiers and Math Functions

In Chapter 4, "Data Types and Names in C," you learned about several data types, such as char, int, float, and double, in the C language. In this hour, you'll learn about four data modifiers that enable you to have greater control over the data. The C keywords for the four data modifiers are

    signed
    unsigned
    short
    long

You're also going to learn about several mathematical functions provided by the C language, such as

    The sin() function
    The cos() function
    The tan() function
    The pow() function
    The sqrt() function




Summary

In this lesson you've learned the following:

  •     The signed modifier can be used to enable the sign bit for the char and int data types.
  •     All int variables in C are signed by default.
  •     The unsigned modifier can be used to disable the sign bit for the char and int data types.
  •     The memory space taken by a data variable can be reduced or increased by using the short, or long, data modifier respectively.
  •     There is a set of C library functions, such as sin(), cos(), and tan(), that can be used to perform trigonometric or hyperbolic computations.
  •     There is another group of math functions in C—for example, pow()—that can perform exponential and logarithmic calculation.
  •     The sqrt() function returns a non-negative square root. The expression sqrt(x) is equivalent to the pow(x, 0.5) expression, if x has a non-negative value.
  •     The header file math.h must be included in your C program if you call some math functions defined in the header file.


 

Related Items

মডুলার C প্রোগ্রামিং (Modular C Programming)

কেবল মাত্র একটি ফাংশন দিয়ে কোনো বড়ো জটিল সমস্যা সমাধানের চেষ্টা করা ভাল প্রোগ্রামিংয়ের পদ্ধতি নয়। সঠিক পদ্ধতি হ'ল সমস্যাটিকে কয়েকটি ছোট ছোট এবং সরল টুকরো করে ফেলা যাতে তা আরও বিশদে বোঝা যায় । তারপরে এই ছোট এবং সরল সমস্যাগুলি সমাধান করার জন্য ছোট ছোট ফাংশন ব্লক তৈরি করা এবং পরে সেগুলি নিয়মানুযায়ী সংযোজিত করা ।

Programming Style

Programming Style

In this section, I'd like to briefly highlight some points that will help you write clean programs that can easily be read, understood, and maintained.

Exercises : Answer the following Question

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.

Question and Answer

    Q Is the C preprocessor part of the C compiler?

    A No. The C preprocessor is not part of the C compiler. With its own line-oriented grammar and syntax, the C preprocessor runs before the compiler in order to handle named constants, macros, and inclusion of files.

Compiling Your Code Under Conditions

Compiling Your Code Under Conditions

You can select portions of your C program that you want to compile by using a set of preprocessor directives. This is useful, especially when you're testing a piece of new code or debugging a portion of code.