here is one of my program that i wrote.
i do not know whats the problem with it.
it seems can't display back the values that i've entered in.
can sir/miss help me to correct my mistake(s).
Thank you!
An array is declared:
datatype array_name[int_size];
Eg. int vals[10];
int *p = vals;
Then p[0] = vals[0] and p[1] = vals[1] and so on.
Also you can access the vals by *(p+i) instead of the [], and the expression is read as the value at the address of p+i.
An array var is also a pointer so you dont need a & in front of it when you assign it to another pointer.But if you want to just point to a single int for example:
int *p = &val; //means p = address of val
and you can access the value a the address pointed to by p usinf another_int = *p ;
Salam friends.this is me faizan ahmed, this program just prints the values which u entered before..as one of my friend was asking to print those entered values so i found this way
Last edited by peter_budo; Apr 24th, 2010 at 6:16 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
This thread is currently closed and is not accepting any new replies.