Incompatible types in assignment in c when assigning same structure members to other members

I am working with c-file i am getting the error incompatible type in assignment. My Code is as follows -

typedef struct
{
 float a1;
 float a2; .... 

 float a26;
}CPS_Param;

typedef struct
{
int b1;
CPS_Param *Param;
}CPS_IPOP;


void main () 
{
CPS_Param pParam;
CPS_IPOP *pStr;

set_Param(&pParam,0.04,0.001,0.01,0.67,0.07,....26parameters);

.....my program

pStr->Param->a1 = pParam.a1;
...26 repeat

}

set_Param(CPS_Param *pParam,float Param1, float Param2,....26 assignments)
{
pParam->a1 = Param1;   // here i am getting compatability error
pParam->a2 = Param2;   // here i am getting compatability error
...
pParam->a26= Param26;  // here i am getting compatability error
}

`

My main intention is ....i want to create two members one as odinary like pParam and other like *Param which is inside (*pStr). I will first installize the pParam by a function and other values passing as arguments. Finally at the end of the program i will copy the pParam parameters directly to the *Param (inside *pStr). But while i am writing the program i shows incompability of assignment. All the structure members are of different parameters of same data type which cannot be combined as array. Can you point out the mistake i have done...

Answers


For one thing, you have not allocated memory for the CPS_Param pointer inside the CPS_IPOP structure. So you will get a segv when the program is run.

What compiler are you using? Gcc compiles it just fine.


Need Your Help

how do i get a list of nearby users in an android application?

android user-interface gridview social-networking

I am building an application with a UI that gets a list of nearby users to help connect like minded people with similar interests. I know this is not a new concept, apps like Grindr do exactly what...

Intent filter to open playlist from browser in my application

android android-intent intentfilter

I thought I my app has all the possible filters, but still when I click: