how to make this code error free

R

rahul8143

hello,
I am trying following code but it has errors how to solve that
and please help to know difference between value assigned to
pointer/reference?
#include <stdio.h>
void main()
{
int i;
int &k=i;
k++;
printf("val of i is %d\n",i);
k=200;
printf("val of i is %d\n",i);
int *p=&i;
p++;
printf("val of p is %d\n",p);
printf("val of i is %d\n",i);
}
 
A

Artie Gold

hello,
I am trying following code but it has errors how to solve that
and please help to know difference between value assigned to
pointer/reference?
#include <stdio.h>
void main()
{
int i;
int &k=i;
k++;
printf("val of i is %d\n",i);
k=200;
printf("val of i is %d\n",i);
int *p=&i;
p++;
printf("val of p is %d\n",p);
printf("val of i is %d\n",i);
}
Let's see if I can be polite about this...well I can't.

GO AWAY!
 
J

Jaspreet

Artie said:
Let's see if I can be polite about this...well I can't.

GO AWAY!
Artie has said what I also wanted to post. Rahul are you sure this is
possible in C ?

int &k=i;
This type of reference construct is possible in C++.
 
D

Default User

hello,
I am trying following code but it has errors how to solve that
and please help to know difference between value assigned to


*plonk*


I'm happy to be now posting via a real news service again, no more
Google!




Brian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,216
Latest member
topweb3twitterchannels

Latest Threads

Top