Jump to content

Variables: Char

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
phantom3380

phantom3380

    Newbie

  • Members
  • PipPip
  • 15 posts
No matter how hard I try, i CANNOT assign a value for char type. In theory it should go:

char whatever = whicheverletter;
cout << whatever << endl;

But, i can't get the sucker to run without getting an error after compiling...what am i doing wrong? :confused: :confused:
Yea as it was writ: "Compile and Run" :p

#2
icepack

icepack

    Programmer

  • Members
  • PipPipPipPip
  • 115 posts
what is whicheverletter?

are you trying:

char whatever = A

or

char whatever = 'A';

try the single quote

#3
phantom3380

phantom3380

    Newbie

  • Members
  • PipPip
  • 15 posts

icepack said:

what is whicheverletter?

char whatever = 'A';

try the single quote

The single quote is definitely what i am having trouble with...can't seem to find it on my keyboard though...:(
Yea as it was writ: "Compile and Run" :p

#4
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
What kind of keyboard do you have? A single quote is just a double quote with out pressing shift :P

Or you can just copy/paste this

'

#5
phantom3380

phantom3380

    Newbie

  • Members
  • PipPip
  • 15 posts
ummmm (grins sheepishly)

It turns out the single quote was right next to my return key, having spent ten minutes trying to find it :o
Yea as it was writ: "Compile and Run" :p