Click here to Skip to main content
15,888,129 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
#include <stdio.h>
int main(){ 
char l;
char a=l;
char *b =&a;

printf("the address of a is %u\n",&a);
printf("the address of a is %u\n",b);
printf("the value  of a is %c\n",*(&a));
 
return 0;
}


What I have tried:

I tried to get value of a as l
Posted
Updated 26-May-22 6:47am
v2
Comments
Richard MacCutchan 26-May-22 7:23am    
You should use %p for addresses.
Aayush Jain 2022 26-May-22 7:34am    
still not getting address
Richard MacCutchan 26-May-22 7:36am    
What does that mean?

1 solution

Every C programmer should initialize the variable he uses.
Try
C
#include <stdio.h>
int main()
{
  char l = 'F';
  char a = l; // a = 'F'
  char * b  = &a; // b is 'address of' a

  printf("the address of a is %p\n",&a);
  printf("the address of a is %p\n",b);
  printf("the value  of a is %c\n",a);
  printf("the value  of a is %c\n",*(&a));

  return 0;
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900