[AVR club] Problem in Pointer

Started by rahmatoolah abedini November 1, 2013
Hi everybody.
I face with a problem with pointer that I cannot solve it.
I write my project in codevision ver 2.05.3.
Could you help me?
Best regards Ali.

My code:
#include
char var1;
char *poin1;
main()
{
DDRD=0xff;
var1=0Xee;
poin1=@var1; ---> Error: Invalid expression
PORTD=*poin1;
while (1);
}
poin1=&var1 - > should work

From: a... [mailto:a...] On Behalf Of
rahmatoolah abedini
Sent: Friday, November 01, 2013 10:45 AM
To: a...
Subject: [AVR club] Problem in Pointer

Hi everybody.

I face with a problem with pointer that I cannot solve it.

I write my project in codevision ver 2.05.3.

Could you help me?

Best regards Ali.

My code:

#include

char var1;

char *poin1;

main()

{

DDRD=0xff;

var1=0Xee;

poin1=@var1; ---> Error: Invalid expression

PORTD=*poin1;

while (1);

}
What about using a address-of operator (&) instead of invalid @?
...
poin1=&var1;
...
Basic C skill.

HTH,
H.


Yahoo Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/avrclub/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/avrclub/join
(Yahoo! ID required)

<*> To change settings via email:
a...
a...

<*> To unsubscribe from this group, send an email to:
a...

<*> Your use of Yahoo Groups is subject to:
http://info.yahoo.com/legal/us/yahoo/utos/terms/
hi,
try : point1 = (char*)@var1 ;

---In a..., wrote:

Hi everybody.
I face with a problem with pointer that I cannot solve it.
I write my project in codevision ver 2.05.3.
Could you help me?
Best regards Ali.

My code:
#include
char var1;
char *poin1;
main()
{
DDRD=0xff;
var1=0Xee;
poin1=@var1; ---> Error: Invalid expression
PORTD=*poin1;
while (1);
}
Hi,

I do not have codevision, but below is correct expression:
*point1 = (char*)(&var1);

As I know, @ is not a C operator.

WBR,
Andrew

---In a..., wrote:

hi,
try : point1 = (char*)@var1 ;

---In a..., wrote:

Hi everybody.
I face with a problem with pointer that I cannot solve it.
I write my project in codevision ver 2.05.3.
Could you help me?
Best regards Ali.

My code:
#include
char var1;
char *poin1;
main()
{
DDRD=0xff;
var1=0Xee;
poin1=@var1; ---> Error: Invalid expression
PORTD=*poin1;
while (1);
}
i want to write :
point1 = (char*)&var1 ;

On Friday, November 1, 2013 1:17 PM, "i...@yahoo.com" wrote:

 
hi,
try  : point1 = (char*)@var1 ;

---In a..., wrote:
Hi everybody.
I face with a problem with pointer that I cannot solve it.
I write my project in codevision ver 2.05.3.
Could you help me?
Best regards Ali.

My code:
#include
char  var1;
char *poin1;
main()

DDRD=0xff;
   var1=0Xee;
   poin1=@var1;    ---> Error: Invalid expression
   PORTD=*poin1;
while (1);
}
--- In a..., rahmatoolah abedini wrote:
>
> Hi everybody.
> I face with a problem with pointer that I cannot solve it.
> I write my project in codevision ver 2.05.3.
> Could you help me?
> Best regards Ali.
>
> My code:
> #include
> char var1;
> char *poin1;
> main()
> {
> DDRD=0xff;
> var1=0Xee;
> poin1=@var1; ---> Error: Invalid expression
> PORTD=*poin1;
> while (1);
> }
>

hi

you should use pint1=&var1 .to solve you error !!!



Yahoo Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/avrclub/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/avrclub/join
(Yahoo! ID required)

<*> To change settings via email:
a...
a...

<*> To unsubscribe from this group, send an email to:
a...

<*> Your use of Yahoo Groups is subject to:
http://info.yahoo.com/legal/us/yahoo/utos/terms/
Why don't you get rid of poin1 as follows? Use var1 directly. poin1 seems redundant in your code.
#include
char var1;
main()
{
DDRD=0xff;
var1=0Xee;
PORTD=var1;
while (1);
}
Thank you. I had mistake in writing. it was correct. poin1=&var1;
best regards
Ali

On Friday, November 1, 2013 9:42 AM, Meir Home wrote:

 
poin1=&var1                         - > should work
 
 
From:a... [mailto:a...] On Behalf Of rahmatoolah abedini
Sent: Friday, November 01, 2013 10:45 AM
To: a...
Subject: [AVR club] Problem in Pointer
 
 
Hi everybody.
I face with a problem with pointer that I cannot solve it.
I write my project in codevision ver 2.05.3.
Could you help me?
Best regards Ali.
 
My code:
#include
char  var1;
char *poin1;
main()

DDRD=0xff;
   var1=0Xee;
   poin1=@var1;    ---> Error: Invalid expression
   PORTD=*poin1;
while (1);
}