블로그 이미지
Leeway is... the freedom that someone has to take the action they want to or to change their plans.
maetel

Notice

Recent Post

Recent Comment

Recent Trackback

Archive

calendar

1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
  • total
  • today
  • yesterday

Category

Steve Oualline
Practical C Programming

5. Arrays, Qualifiers, and Reading Numbers


An array is a set of consecutive memory locations used to store data. Each item in the array is called an element. The number of elements in an array is called the dimension of the array.
To reference an element of an array, you use a number called the index -- the number inside the square brackets.



Strings are sequences of characters. Strings are just character arrays with a few restrictions.

\0


strcpy(string1, string2)
Copy string

variable-length strings


strcat(string1, string2)
Concatenate strings
: to add a space


strlen(string)
Get string length


strcmp(string1, string2)
Compare two strings


fgets
Get string from stream
fgets (name, sizeof (name), stdin);
cf. Chapter 14. File Input/Output


sizeof (name)

stdin
standard input stream


'\n'
newline

'\0'
end-of-line



Multidimensional Arrays

type variable[size1][size2];


printf

scanf
Read formatted data from stdin

fgets

sscanf
Read formatted data from string
: string scanf


C lets you give detailed information about how the hardware is to be used.    - 75p

Types of Integers
%hd
signed short int

%d
signed int

%ld
signed long int

%hu
unsigned short int

%u
unsigned int

%lu
unsigned long int


Types of Floats
%f
float (printf only)

%lf
double (scanf only)

%Lf
long doubel (not available on all compilers)



Side Effects
A side effect is an operation that is performed in addition to the main operation executed by the statement.




'@GSMC > 서용덕: DMD Programming' 카테고리의 다른 글

[Steve Ouallline] 6. Decision and Control Statements  (0) 2008.03.25
week 3 review  (0) 2008.03.22
hw2  (0) 2008.03.15
week 2 review  (0) 2008.03.15
[Steve Oualline] 4. Basic Declarations and Expressions  (0) 2008.03.10
posted by maetel