Pergunta de entrevista da empresa Qualcomm

C function to detect odd number, detect if number is odd , calculate characters in string

Resposta da entrevista

Sigiloso

6 de mar. de 2014

Remainder divide the number by 2 (int result = number % 2). Check that the result is not zero (result != 0) in an if statement. To calculate the characters in a string, make a character array that is equal to the string (i.e. char charArray[] = "unknown string"). Then make a loop that increments everytime the character array does not equal the null character, which is the character used to terminate a string. The variable you use to increment in your loop is also your character counter. for (i = 0; charArray[i] != \0; i++) { }