c - incompatible type for argument 2 of ‘strcpy’ -


i hopping can me c code. i'm getting error:

error: incompatible type argument 2 of ‘strcpy’      strcpy(tmp, (sb->jnodes[j])); 

here's code error happens:

for (int j = 0; j < 20; j++) {     inode *tmp = malloc(sizeof(inode));     strcpy(tmp, (sb->jnodes[j]));     if(tmp->size == -1) {         inode *oldroot = sb->root;         inode *newshadowroot;         strcpy(newshadowroot, oldroot);         strcpy(tmp, newshadowroot);         strcopy(sb->jnodes[j], tmp);         break;     }     free(tmp); } 

and here's data structures:

typedef struct inode {     int mode;     int id;     int size;     int pointers[num_pointers]; } inode;   typedef struct superblock {     int magic_number;     int block_size;     int num_blocks;     int num_inodes;     inode *root;     inode jnodes[20]; } superblock; 

try

memcpy(tmp, &(sb->jnodes[j]), sizeof(sb->jnodes[0])); 

not strcpy since you're not copying strings.


Comments

Popular posts from this blog

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

android - ConstraintLayout: Realign baseline constraint in case if dependent view visibility was set to GONE -

c# - Populating Gridview inside Listview ItemTemplate On Web User Control from Code Behind -