Jump to content

problem with pointers and arrays


ilmenator

Recommended Posts

Hi,

I have this


typedef struct prog_list_tag {

  u16 index;

  u16 bank_number;

  char file_name[4];

  char bank_name[16];

} prog_bank_list_t;


// each entry represents one available PROG bank on SD card

prog_bank_list_t prog_bank_list[100];
and this:
extern char current_prog_bank_name[16];

How can I copy the bank_name in the struct (e.g. the one in the second entry of prog_bank_list) into the array current_prog_bank_name?

I think I got a mental block right now...

Link to comment
Share on other sites

  • 3 years later...

I also want to "memcpy"

C, 8Bit Core, 18F4685:

 

 

 #include <string.h>

int MtxLoad0[8]; //Destination Array
int Mtx0Part0[8]; //Source Array

if(pin == 0 && pin_value == 0){memcpy(MtxLoad0, Mtx0Part0, 8);}

give me this error:

 

error: missing definition for symbol "_memcpy", required by "_output/main.o"

 


where do i have to define "memcpy"?

Link to comment
Share on other sites

ok thankz i made this:

 

#include <string.h> 
int MtxLoad0[8];  //Destination Array 
int Mtx0Part0[8]; //Source Array 
int LoroCount;    //counter 4 "for" loop  -LoadRoll...

if(pin == 0 && pin_value == 0)
{for(LoRoCount=0; LoRoCount<8; LoRoCount++) {MtxLoad0[LoRoCount]=Mtx0Part0[LoRoCount];}}
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...