Browsing all articles tagged with c programming in embedded system - Share Programming Tips
Feb
19

In embedded domain, Copying of structure is why avoided in c programming?

 

 

Generally  In embedded software domain for copying structure of same type people dont prefer to use direct assignment and do that by memcpy function or by doing assignment of each element of structure.

Look at Example

struct student {
int roll_no;
int age;
};
struct student exmple1 = {32,15};
struct student exmple2;

for copying exmple1 into exmple2.. instead of writing direct

exmple2=exmple1;

people like to use

memcpy(exmple2,exmple1,sizeof(struct student));

or

exmple2.roll_no=exmple1.roll_no;
exmple2.age=exmple1.age;
Why?

read more

Follow us on Twitter! Follow us on Twitter!

Search in this website

our sponsors

latest comments

Find us on Facebook

Top Authors

36 posts
saurabh
22 posts
10 posts

Find us on stackoverflow

Polls

Tell us who you are

View Results

Loading ... Loading ...

My Bookmarks

Sponsers Link