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

c# - Update a combobox from a presenter (MVP) -

How to understand 2 main() functions after using uftrace to profile the C++ program? -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -