0
#include<stdio.h>
int main(void)
{
char letter;
char *pletter;
pletter = &letter;
printf("%p", &letter;
putchar('\t');
printf("%p", letter);
putchar('\n');
puts("Understand?\nWhat is the right way? it is 4bytes different");
//*allows the value to be altered by the base adderess
//&lets a datatype to value by its adderess from another datatype takes 2 datatypes of same size(bytes)
return 0;
3
Contributors
4
Replies
5
Views
11 Years
Discussion Span
Last Post by majicbeans
0
#include<stdio.h>
int main(void)
{
char letter;
char *pletter;
pletter = &letter;
printf("%p", &letter;
putchar('\t');
printf("%p", letter);
putchar('\n');
puts("Understand?\nWhat is the right way? it is 4bytes different");
//*allows the value to be altered by the base adderess
//&lets a datatype to value by its adderess from another datatype takes 2 datatypes of same size(bytes)
return 0;

For future, please don't ask your question in the code. Ask in the text area. It took me three times longer to decypher your question...

The reason is that it's is simpler for the system allocate the variables on 4-byte boundaries. So if you have a char* array of 6 bytes, you'll see an 8-byte difference.

0

printf("I looked at it closer now I understand the & to get it from the adderess, that code always need to have the &.\nAbout using the right adderess, or it will not process the variable the right way.\n"); printf("I am sorry if I am making a nuisance outta myself or if I am making you work harder\n"); [\code][code=c]
printf("I looked at it closer now I understand the & to get it from the adderess, that code always need to have the &.\nAbout using the right adderess, or it will not process the variable the right way.\n");
printf("I am sorry if I am making a nuisance outta myself or if I am making you work harder\n");
[\code]

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.