939. Find the ASCII Value of a Character

You are given a single character c. Your task is to find and return the ASCII value of the given character.

Example 1:

Input: c = 'A'

Output: 65

Explanation: The ASCII value of uppercase 'A' is 65.

Example 2:

Input: c = 'e'

Output: 101

Explanation: The ASCII value of lowercase 'e' is 101.

Now Your Turn!

Pick the correct output for the given input

Input: c = '7'

Still unsure what the problem is asking ?

Let’s go through a few more examples, step by step, to make it clearer.

Constraints:

  • The input character c will be a printable ASCII character.
  • c will always be a single character.
0
class Solution {
public:
int getASCII(char c) {
// Your code goes here
}
};
Test Case

Input:

C