コード例 #1
0
ファイル: ex14.c プロジェクト: slugbyte/c-the-hard-way
void printLetters(char str[]){
  for(int i=0; str[i] != '\0'; i++){
    char ch = str[i];

    if(canPrintIt(ch)){
      printf("%c == %d\n", ch, ch);
    }
  }
}
コード例 #2
0
ファイル: ex14.c プロジェクト: Attler/hello-world
void printLetters(char arg[])
{
	int i = 0;
	for(i = 0; arg[i] != '\0'; i++) {
		char ch = arg[i];
		
		if(canPrintIt(ch)) {
			printf("'%c' == %d ", ch, ch);
		}
	}
	printf("\n");
}
コード例 #3
0
ファイル: ex14.c プロジェクト: TravisAvey/C
/*
	This method prints the chars passed into main
	from the printArguments() method if the letters
	are either an alpha or a blank space
*/
void printLetters(char arg[])
{
	// loop through the array, as long as
	// the arg[] is not a '\0'
	for (int i = 0; arg[i] != '\0'; i++)
	{
		// set current array element to ch
		char ch = arg[i];

		// if canPrintIt() returns true, then print out the
		// character and the decimal version of the char
		if (canPrintIt(ch))
			printf("'%c' ==  %d", ch, ch);
	}

	printf("\n");
}