how to change a char into another char with numbers..

This is a discussion on how to change a char into another char with numbers.. within the C Programming forums, part of the General Programming Boards category; i know that 'c'-'a'=2 using that property how do i change 'a' into 'c' ?? i think its Code: char ...

  1. #1
    Banned
    Join Date
    Aug 2009
    Posts
    43

    how to change a char into another char with numbers..

    i know that 'c'-'a'=2

    using that property
    how do i change 'a' into 'c'

    ??

    i think its
    Code:
    char c;
    c='c'
    c=c-2;
    correct?

  2. #2
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Quote Originally Posted by kakaroto View Post
    i know that 'c'-'a'=2

    using that property
    how do i change 'a' into 'c'

    ??

    i think its
    Code:
    char c;
    c='c'
    c=c-2;
    correct?
    No, you said 'a' into 'c'. So it's

    Code:
    char c = 'a' + 2;

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, 02:22 PM
  2. get keyboard and mouse events
    By ratte in forum Linux Programming
    Replies: 10
    Last Post: 11-17-2007, 05:42 PM
  3. Change a line of text eash first char to uppercase
    By zp523444 in forum C Programming
    Replies: 17
    Last Post: 03-15-2004, 07:43 PM
  4. AnsiString versus char *
    By Zahl in forum C++ Programming
    Replies: 35
    Last Post: 10-16-2002, 09:38 PM
  5. errors in class(urgent )
    By ayesha in forum C++ Programming
    Replies: 1
    Last Post: 11-10-2001, 10:14 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21