CSC_Test_1_Study_Guide_1

CSC_Test_1_Study_Guide_1 - *Compiling Step #1: Lexical...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
* Compiling Step #1: Lexical Scanning - Divides the program into tokens, which are the smallest meaningful units of a program. - Tokens in C are: - Identifiers (num_records , cust_count) #include <stdio.h> - Keywords (while , if , char) #include <stlib.h> - Constants/Strings (3.4151 , “Answer: “) - Operators (+, =, ^,*) int main(void) - Explicit separators ({ , ( , ;) { -White space is ignored, except as explicit separators. unsigned int a; -Scan from left to right always grabbing the largest token possible. int c; (d=-c+++a; is d = - c ++ + a ;) *Identifiers c = getchar(); - consist of letters , _ , and digits while (c != ‘\n’){ - can’t start with a digit a = a*10 + (c –‘0’); - are case sensitive c = getchar(); - length is unlimited but only first 31 matter. } *Types of Constants: } - integer - floating point - character (really, a type of integer) - enumeration *Character constants in single quotes, ex. ‘a’, or ‘b’, is the numeric value of the constant in ASCII. *Useful character constants:
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/28/2009 for the course CSC 230 taught by Professor Freeh during the Spring '08 term at N.C. State.

Page1 / 2

CSC_Test_1_Study_Guide_1 - *Compiling Step #1: Lexical...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online