F
Frank Silvermann
I have taken an extraordinary leap into the modern world by purchasing
webspace. In addition to my private concerns, I would like to make a
part to which others, e.g. my nieces and ex-wife, can ftp. To keep a
hold of the reigns, I shall write a program that changes the password,
and the brains of this prog will be in C:
#def MIN_WORD_LENGTH 9
#def MAX_WORD_LENGTH 15
/* subroutine for random permutation */
void permute(char *, int)
/* main
char p[] = "abcdefghijklmnopqrstuvwxyz";
char q[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
char r[] = "0123456789";
void swap(char *, char *);
end main */
void permute(char *m , int n)
{ ; }
void swap(char *a, char *b)
{
char c;
c = *a;
*a = *b;
*b = c;
}
/* end pseudosource */
I'm going to build a word from p, q and r. At this point, I have 2
questions:
1) Does the scope look right? I've got the subroutine at file scope and
the swap at block scope. If I make a call to swap from within permute(),
is every ISO compiler going to know what I'm talking about?
2) Is it foolhardy of me to think that I can permute a string given its
pointer and length, without needing any information back, hence the void
declaration? frank
-------
webspace. In addition to my private concerns, I would like to make a
part to which others, e.g. my nieces and ex-wife, can ftp. To keep a
hold of the reigns, I shall write a program that changes the password,
and the brains of this prog will be in C:
#def MIN_WORD_LENGTH 9
#def MAX_WORD_LENGTH 15
/* subroutine for random permutation */
void permute(char *, int)
/* main
char p[] = "abcdefghijklmnopqrstuvwxyz";
char q[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
char r[] = "0123456789";
void swap(char *, char *);
end main */
void permute(char *m , int n)
{ ; }
void swap(char *a, char *b)
{
char c;
c = *a;
*a = *b;
*b = c;
}
/* end pseudosource */
I'm going to build a word from p, q and r. At this point, I have 2
questions:
1) Does the scope look right? I've got the subroutine at file scope and
the swap at block scope. If I make a call to swap from within permute(),
is every ISO compiler going to know what I'm talking about?
2) Is it foolhardy of me to think that I can permute a string given its
pointer and length, without needing any information back, hence the void
declaration? frank
-------