Click here to Skip to main content
15,065,914 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am trying to pass the particular value of the structure.
below is the structure
typedef struct msg_format
char *phone_number[MAX_FIELDS];
char *message[2];

and i am trying to pass value message[1]; only one variable

What I have tried:

i had tried like this in code.
int compare_with_whitelist_number(message_format storage1)
        int i,j=1;
        char temp[10];
         char value[20];
        for(i = 0; i < MAX_FIELDS; i++){
                while(j <= WHITELIST_NUMBER)
                        sprintf(temp, "Number%d",j);
                        get_xml_content(FILE_NAME, PARENT_NODE ,temp,value);
                        if(storage1.phone_number[i] == value)
                                DEBUG("valid whitelist number:pointing to message\n");
                                return SUCCESS;


        return FAILURE;

its is right or wrong i don't please suggest how to pass that value in function and how can i get that value in the function operation
int check_with_message_format(?)<pre>
Updated 11-Dec-19 22:40pm

It is very easy by accessing the member of the struct. Tip use & operator for not copying struct memory.
int check_with_message_format(struct msg_format &input)

Your phone number comparison isnt working use strcmp() function.
int check_with_message_format(char *message);
According to your code snippet, your phone_number and message array member better have the same number of elements.
typedef struct msg_format
    char *phone_number[MAX_FIELDS];
    char *message[MAX_FIELDS];
} message_format;

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900