{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Guidelines - memory will be allocated to a particular 3...

Info icon This preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
Comments if(isdigit) /* error */ /* * Program to sort integer values */
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Comments and Identifiers Make every comment count. Don't over-comment. Make sure comments and code agree.
Image of page 2
3: Line Structure, Identifiers Two lines my\ id are joined during compiler translation into myid An identifier is a sequence of letters, digits, and underscores that does not start
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
The documentation of programs, which are available to clients , should make it clear whether you are using identifiers whose length exceeds 6 characters. Never use identifiers that have more than 31 characters. Identifiers
Image of page 4
Identifiers Use a consistent style throughout your code. Variables should have meaningful names when appropriate . You are encouraged to mix case to make your identifiers more readable:
Image of page 5

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
3: Primitive Data Types C provides several primitive data types: char , int , float and double . No built-in Boolean type; instead use int : the value 0 stands for false, any non-zero value stands for true No guarantee that a specific amount of
Image of page 6
Image of page 7

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 8
Image of page 9

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: memory will be allocated to a particular 3: Memory and Range of Values • Computer memory consists of words ; each word consists of a number of bytes , a byte consists of a number of bits (usually 8 bits). • Signed integers use the leftmost bit (sign bit), to represent the sign. The largest unsigned 16-bit integer: 216 - 1 The largest signed 16-bit integer: 215 - 3: Integer Types • plain, signed and unsigned • short unsigned int • signed long • int • size ( short ) <= size ( int ) <= size ( long ) • To support portability, use only integers in the ranges specified in limits.h For example, you can always use plain integers in the range from -32,767 to 32,767 Any other assumptions, such as that the size of an int is 4 bytes, must not be made. Ranges • In order to check whether the sum of two integers i and overflows , • do not use • i + j > INT_MAX • Instead, use Overflow...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern