Thread: Problem with a char variable set as a letter

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    C(++)(#)
    Join Date
    Jul 2004
    Posts
    309

    Problem with a char variable set as a letter

    Ok in a program I'm working on I have a variable declared as such:
    Code:
    char newgrade;
    Now in a function I'm trying to set this variable to equal a letter based upon the comparison of variable to a number, such as this:
    Code:
         if(gradevar>=1 || gradevar<=1&&gradevar>=.90)
         {
             newgrade="A";
         }
    Now, I was taught that the "char" variable was used to store a letter. If so why am I getting the error: invalid conversion from `const char*' to `char'? Is there a diffrent variable I should use? Would it be better to use a string as the variable type? Or if possible explain what the error meant?


    Also I have tried using an array and I get the same error.
    Last edited by 7smurfs; 12-10-2004 at 12:00 PM.
    To code is divine

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. seg fault at vectornew
    By tytelizgal in forum C Programming
    Replies: 2
    Last Post: 10-25-2008, 01:22 PM
  2. Code review
    By Elysia in forum C++ Programming
    Replies: 71
    Last Post: 05-13-2008, 09:42 PM
  3. Replies: 9
    Last Post: 11-23-2007, 12:28 PM
  4. problem in char variable
    By hitesh_best in forum C Programming
    Replies: 2
    Last Post: 08-11-2007, 12:01 AM
  5. Need help understanding info in a header file
    By hicpics in forum C Programming
    Replies: 8
    Last Post: 12-02-2005, 12:36 PM