-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
hai to everybody
i am trying some coding as such flow it works or not
code is
int *p;
*p=20
printf("%d",*p);
Besides the fact these statements do not constitute a valid C program or
function, and thus are uncompilable as they stand, I only see one problem with
your code. You declare p as a /pointer/ to an integer, but never initialize p to
contain a pointer value. the
int *p;
alone is insufficient to permit the proper operation of
*p=20;
because p does not have a value.
Your code should look something like....
#include <stdio.h> /* for printf() prototype */
void myfunction(void)
{
int *p; /* a place for a pointer */
int q; /* a place for an integer */
p = &q; /* initialize p to point to int q */
*p = 20; /* initialize the int that p now points to */
printf("%d\n",*p); /* print the int value */
}
- --
Lew Pitcher
IT Specialist, Enterprise Data Systems,
Enterprise Technology Solutions, TD Bank Financial Group
(Opinions expressed are my own, not my employers')
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
iD8DBQFDV5fhagVFX4UWr64RAnc6AJ43kLASHNqZ9bJ3RvCcnnOsQIgVowCcDsyb
t2RW5qNDmPwxoJs+ApmQ/zw=
=RpKA
-----END PGP SIGNATURE-----