The program you posted is still wrong. The answer would be undefined because p = the letter 'E' and p is the letter 'A'. so p+'E'+'A' = p+69+65, or 127 bytes beyond the end of the buffer. Where did I get those numbers? From any ascii chart, like this one.
The code shall print garbage value. Here's why..
p = E ascii code 69, p = A ascii code 65. But p is a itself pointer location.
so p+p+p, will point to the memory location 126 specs beyond the base address of the array c. Hence the printed value will be garbage. if you are sure about the result then please post the entire code.the provided fragment doesn't make sense.
I GOT IT... printf("%s",p+p+p)
here p is a pointer pointing to the string so it will contain the base address of "gate 2011"
p=e [ascii code=69] and
p=a [ascii code=65]
and p+4 means incrementing p by 4,pointer p will now point to 2
and when we print the pointer with specifier %s it prints the string with base address starting at p+4.
hence output is 2011...
public class GrossmontBank
//class variables (global - accessible throughout this class)
//scanner object to be used throughout
private static Scanner input = new Scanner(System.in);