Thread: called object is not a function

  1. #1
    Registered User
    Join Date
    Nov 2011
    Posts
    9

    called object is not a function

    I have two structs in a header file.In the first one i have an array that's type is of the second struct. Something like this
    Code:
    typedef struct transaction {
        int type;
            char name[40];                                
        int moment;                    
    } transaction;
    
    typedef struct account {
    ...
    transaction pinakas[20];
    ...
    } account;

    And i want to call sprintf function to to write some data like this
    Code:
     sprintf(t," &s", sm_data->pinakas(i).name);
    and i'm getting this error i'm mentioning in the thread's title.Any help"????

  2. #2
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    You want %s not &s and [i] not (i).
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  3. #3
    Registered User
    Join Date
    Nov 2011
    Posts
    9
    thank you so much!!!!

  4. #4
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    [] is for array indexing, not ()
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. why is object file called so?
    By jackson6612 in forum Tech Board
    Replies: 2
    Last Post: 09-24-2011, 05:36 AM
  2. Getting Error: Called Object is not a Function
    By Ketsueki in forum C Programming
    Replies: 3
    Last Post: 06-23-2010, 05:51 AM
  3. Replies: 2
    Last Post: 08-02-2008, 09:38 PM
  4. error: called object is not a function
    By sweetorangepie in forum C Programming
    Replies: 3
    Last Post: 03-20-2008, 06:47 PM
  5. error: called object is not a function
    By yougene in forum C Programming
    Replies: 1
    Last Post: 07-24-2007, 09:32 PM