Notes for class

Void strcopy(char *d, *s)

{

while(*d++ = *s++);

}

void strcopy(char *d, *s)

{

while(*s!=0)

{

*d = *s;

d = d + 1;

s = s + 1;

}

*d = 0;

}

Both of these segments of code do exactly the same thing.

__________________

Problem: a divide by four gives a 1 or 2 remainder

Solution:

If((a%4) == 1 || (a%4) == 2){É..

OrÉeven better would beÉ.

If((a+1)&2){ÉÉ

Explanation:

0 Ð 00    +1        ->             01

1 Ð 01     +1        ->             10    -use & to check for true with 10

2 Ð 10    +1        ->             11    -use & to check for true with 10

3 Ð 11    +1        ->             00

_______________________________

void JC(char *d, *s)

{

while(*s)

{

if(*s == Ô_Õ)

*d = Ô_Õ;

else

*d = ÔAÕ + ((*s Ð ÔAÕ) +7) %26);

}

d++;

s++;

*d=0   -> this sets the NULL

}

instead of the   *d = ÔAÕ + ((*s Ð ÔAÕ) +7) %26);

you can have:

{

*d = *s + 7;

if(*d > ÔzÕ)

d-=26;

}

//function that counts vowels

int CV(char *s)

{

int r = 0;

while(*s)

{

if(*s == ÔAÕ || *s == ÔEÕ || *s == ÔIÕ || *s == ÔOÕ || *s == ÔUÕ)

r++;

s++;

}

return r;

}

Announcements and Notes:

.h files have function names and descriptions

when I doubt of order of operations, use parentheses

All tests are open book.

Stacey is going to run WINE in Cygwin in WINE in Cygwin ÉÉÉ  and then she will find a bit pattern in all of the vowelsÉof every language

HOMEWORK ASSIGNMENT:

Read in a sequence of integers (scanf/printf), and print them in reverse order.

The sequence is terminated by a 0.

Do this both recursively, and non recursively.