Datasheet

{} ()
#include <stdio.h>
unsigned int factorial(unsigned int x);
int main()
{
unsigned int i = 3; /* Declare an int and assign it the value three. */
printf("%d! = %d\n",i,factorial(i) ); /* Print factorial of i */
return 0; /* Return success to the operating system. */
}
x
factorial i
int
int *p = 0; /* Declare a pointer p and assign it a null address. */
int i; /* Declare an int i. */
p = &i; /* Assign the address of i to p. */
#include <std io.h>
void fun(int, int *); /* A function with no return value. */
int main()
{
int np = 1, p = 1; /* Initialise two int variables */
printf("&np=%p, p=%p\n",&np, &p); /* Print the addresses. */
printf("Before fun(): np=%d, p=%d\n",np,p); /* Print the values. */
fun(np,&p); / * Pass the value of np and the address of p. */
return 0; /* Return success to the operating system. */
}
void fun(int np, int *p)
{
np = 2; /* Assign 2 to the local variable np. */
*p = 2; /* Assign 2 to the memory of p defined in main. */
printf("&np=%p, p=%p\n",&np, p); /* Print the addresses. */
}
p p
fun