redho home | products | services

Programming Forums


Community for Java, PHP, Perl C, ASP and Python programmers
Monday 06 September 2010 14:43

Ask your IT question here

Array copying problem



 
Post new topic   Reply to topic    Programming Forums -> C programming forum
View previous topic :: View next topic  
Author Message
arun10427
New Programmer


Joined: 04 Mar 2010
Posts: 1
Hi I am trying to copy one struct to another, but I am making some minor mistake that it is not getting copied. Can someone help me fix it?

Code:

#include<stdio>
#include<stdlib>
typedef struct
{
    int inst_addr;
}instruction;

void copy_struct(instruction src,instruction dest)
{
    dest.inst_addr = src.inst_addr;
}

int main()
{
    int addr = 1000;
    instruction check1;
    instruction check2;
    check1.inst_addr = 10;
    check2.inst_addr = 50;   
    copy_struct(check1,check2);
    printf("%d",check2.inst_addr);
}       


Reply with quote
 
Page 1 of 1
Post new topic   Reply to topic    Programming Forums -> C programming forum


Dubai Forums - Expat Help | Vegan Forum | Java Programming | 3d Design Resources | 3d Forum | 3D Jobs | 3D Textures | Paris Forum | Europe Forum
Dubai Classifieds | Dubai Property | Jobs in Dubai | Free London Classifieds | Jobs in London UK

High Quality, Custom 3d animation and Web Design solutions Royal Quality Web Hosting Services Vegetarian and Animal Rights news

Based on phpBB © 2001-2010 RedHo