for loop skipping items

From: Québec (Once_at_WasEno.ugh)
Date: 07/30/04


Date: Fri, 30 Jul 2004 09:57:32 -0400

How comes the for loop just printf 3 characters?

1 e
7 e
10 e

The string mixed by C is : J?an Pi?rr?

=========
fmt string is "Jean Pierre"
---------------
const char *fmt;
....
strcpy(ligne, fmt);
...
for(i=0;i<11;i++){
  for(j=0;j<65;j++){
    if(alphabet[j] == fmt[i]){
  ligne[i] = alphabet[65-j];
  printf("%d %c\n", i, fmt[i]);
  break;
  }
  }
}

===
char alphabet[] = {
   '0','1','2','3','4','5','6','7','8','9',
   'A','B','C','D','E','F','G','H','I','J', 'K','L','M','N',
   'O','P','Q','R','S','T','U','V','W','X','Y','Z', ' ',
   'a','b','c','d','e','f','g','h','i','j','k','l','m','n',
   'o','p','q','r','s','t','u','v','w','x','y','z', '_', '-'};



Relevant Pages