Thread: mixed type / buffer over flow

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Register User andor's Avatar
    Join Date
    Aug 2006
    Location
    Novi Sad
    Posts
    42
    Quote Originally Posted by DavT
    Be warned though that even if you make c an unsigned char the printf function will cast it to a signed int and you will see exactly the same result
    No the result will be 249

  2. #2
    Learner Axel's Avatar
    Join Date
    Aug 2005
    Posts
    335
    thanks davt

    just another question why isn't the following casted to a char and then stored as a two's complement?

    Code:
    printf("%c", q * i * j);

  3. #3
    Register User andor's Avatar
    Join Date
    Aug 2006
    Location
    Novi Sad
    Posts
    42
    becouse you dont have explicit cast like this
    printf("%c\n", (char) (q * i * j));

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Buffer Over Flow with string Arrays
    By vlrk in forum C Programming
    Replies: 1
    Last Post: 06-24-2008, 07:16 AM
  2. Segmentation Fault?
    By John_L in forum C Programming
    Replies: 10
    Last Post: 10-02-2007, 08:37 AM
  3. scanf oddities
    By robwhit in forum C Programming
    Replies: 5
    Last Post: 09-22-2007, 01:03 AM
  4. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 10:03 AM
  5. Erros in Utility Header File
    By silk.odyssey in forum C++ Programming
    Replies: 4
    Last Post: 12-22-2003, 06:17 AM