Thread: How I can fund out that what is going on inside of a varibale

  1. #1
    Registered User
    Join Date
    Mar 2014
    Posts
    1

    How I can fund out that what is going on inside of a varibale

    I would like to print result in end of this function and see what is going on there. Please let me know how I can use printf here?

    Thanks

    Code:
    Value *
    stringToValue(char *val)
    {
    Value *result = (Value *) malloc(sizeof(Value));
    
    switch(val[0])
    {
    case 'i':
    result->dt = DT_INT;
    result->v.intV = atoi(val + 1);
    break;
    case 'f':
    result->dt = DT_FLOAT;
    result->v.floatV = atof(val + 1);
    break;
    case 's':
    result->dt = DT_STRING;
    result->v.stringV = malloc(strlen(val));
    strcpy(result->v.stringV, val + 1);
    break;
    case 'b':
    result->dt = DT_BOOL;
    result->v.boolV = (val[1] == 't') ? TRUE : FALSE;
    break;
    default:
    result->dt = DT_INT;
    result->v.intV = -1;
    break;
    }
    
    return result;
    }
    

  2. #2

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 05-19-2010, 09:11 AM
  2. Varibale scope and memory allocation
    By Guang Yan Wang in forum C Programming
    Replies: 2
    Last Post: 02-25-2004, 09:16 AM
  3. visual c++ isnt likng my varibale
    By Klinerr1 in forum C++ Programming
    Replies: 13
    Last Post: 11-06-2002, 12:20 PM
  4. seperate varibale
    By Klinerr1 in forum C++ Programming
    Replies: 3
    Last Post: 09-02-2002, 09:56 PM
  5. Declaring a DATE varibale
    By Unregistered in forum C++ Programming
    Replies: 0
    Last Post: 06-18-2002, 09:32 AM

Tags for this Thread