;; Alternate definition of C-c g as a shortcut for goto-line using Lisp strings.(global-set-key"\C-cg"'goto-line)

Finally, you can use a Lisp vector. Vectors are written in square brackets, and characters in vectors are written with a
question mark and slash in front of them.

;; Alternate definition of C-c g as a shortcut for goto-line using Lisp vectors.(global-set-key[?\C-c?\g]'goto-line)

I usually try the kbd method first, since it will usually work. You can use array to make use of strange keytrokes.
Simply type C-q and the keystroke you're interested in to insert the code for it.

For example, if we type C-q C-c we get ^C, and C-q g gives simply g, so the example above can also be written like:

;; Another alternate definition of C-c g as a shortcut for goto-line using Lisp vectors.(global-set-key[?^C?g]'goto-line)

I have to say, that there are some keystrokes whose codes I have trouble getting emacs to understand this way, but using
C-c h and kbd will usually do the trick. There's certain keys you won't be able to use. For example if you're on a
Windows system and you hit the Windows key while using Emacs in a terminal, you'll get the Start menu on Windows instead
of a keystroke sent to Emacs.