Jump to content
Sign in to follow this  
FrankGe

Problem With Arrays

Recommended Posts

Hello,

 

A little project with 3 files

main.c

arrTest.h

ArrTest.c

 

Main.c

---------

#include <system.h>

#include "arrtest.h"

 

extern char arr[20];

 

void main()

{

char i, j;

 

initArr();

 

while (1)

{

for (i = 0; i < 20; i++)

{

j = arr;

}

}

}

 

arrTest.h

-----------

#ifndef _ARRTEST_H_

#define _ARRTEST_H_

 

void initArr();

 

#endif

 

arrTest.c

-----------

#include "arrTest.h"

 

char arr[20];

 

void initArr(void)

{

char i;

for (i = 0; i < 20; i++)

arr = i;

}

 

Problem:

Watch the result of j in main.c with the debugger.

I should expect 0 , 1, 2, 3, ... 19

 

What I see with the debugger is not what i expect.

 

PIC: 16F877A

OS: Windows XP SP2

 

Frank

Share this post


Link to post
Share on other sites

This was a compiler error. Now fixed. Fix will be available in the next release.

 

Regards,

Pavel

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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...
Sign in to follow this  

×
×
  • Create New...