Create, initialize and use pointers with C.
#include <stdio.h>
int main()
{
/* Simple declarations */
char character = 'C';
int integer = 1;
float real = 10.4f;
/* Print variable value with their memory address */
printf("Value of character = %c, Address of character = %u\n", character, &character);
printf("Value of integer = %d, Address of integer = %u\n", integer, &integer);
printf("Value of real = %f, Address of real = %u\n", real, &real);
return 0;
}
Output
Value of character = C,
Address of character = 6422047
Value of integer = 1,
Address of integer = 6422040
Value of real = 10.400000,
Address of real = 6422036
0 Comments