Hi everyone, I'm very new to C coding.
I was just wondering what the mistake is in this code please:
void main()
{
int *p;
int a;
a=20;
*p=a;
printf(“%d”, *p);
}
Thank you
Hi everyone, I'm very new to C coding.
I was just wondering what the mistake is in this code please:
void main()
{
int *p;
int a;
a=20;
*p=a;
printf(“%d”, *p);
}
Thank you
What error are you seeing?
I can guess, but you tell me.
.
p is allocate, *p is not.
p contains a address (pointer) but you did not allocated a space and attributed the beginning of that space to p
Sorry, I'm new to this. What does that mean exactly? ![]()
joelrocks987:
Sorry, I'm new to this. What does that mean exactly?
I asked you what error you are seeing and you refuse to answer?
Right.
.
ieee488:
I asked you what error you are seeing and you refuse to answer?Right.
Sorry man! I missed that there. I haven't compiled it because I haven't got a compiler on this computer.
joelrocks987:
Sorry man! I missed that there. I haven't compiled it because I haven't got a compiler on this computer.
It is a waste of your time and ours until you get serious about programming and install compiler on your PC.
.
ieee488:
It is a waste of your time and ours until you get serious about programming and install compiler on your PC..
I'm using an iPad because I need the answer while I'm unable to access my computer. ![]()
joelrocks987:
I'm using an iPad because I need the answer while I'm unable to access my computer.
Unable or unwilling?
Not our job to give you answers you need to find out for yourself.
.