X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: "aveo" Newsgroups: comp.os.msdos.djgpp Subject: pointers in Strucrure assignment problem Date: 6 Jul 2005 22:17:05 -0700 Organization: http://groups.google.com Lines: 36 Message-ID: <1120713425.526371.222910@g47g2000cwa.googlegroups.com> NNTP-Posting-Host: 59.95.0.191 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1120713429 3008 127.0.0.1 (7 Jul 2005 05:17:09 GMT) X-Complaints-To: groups-abuse AT google DOT com NNTP-Posting-Date: Thu, 7 Jul 2005 05:17:09 +0000 (UTC) User-Agent: G2/0.2 Complaints-To: groups-abuse AT google DOT com Injection-Info: g47g2000cwa.googlegroups.com; posting-host=59.95.0.191; posting-account=JJCVog0AAADHxD7cpVHFH_Oih7K2jhME To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hi all, Output of following program is unexpected. It affecting all elements of LD insted of 0th element Plz help me out. ///////////////////////////////////////////////////////////////// typedef struct LineDate { unsigned char *LinePtr; int LineCount; }LD1; LD1 LD[100]; void main(void) { int i; //Intitialize LineData Structure---->>>>> for(i=0;i<=99;i++) { LD[i].LinePtr = (char *)calloc( 100, sizeof(char) ); LD[i].LinePtr=""; LD[i].LinePtr[0]=13; LD[i].LineCount=1; } //Intitialize LineData Structure<<<<<---- LD[0].LinePtr[0]=97; // Affecting every LinePtr of LD LD[0].LineCount=3; // getch(); } /////////////////////////////////////////////////////////////// Thanks