0

What is the meaning of line:aa=(char*)a; and bb=(char*)b;......its a c language program

#include<stdio.h> int main() { int a=54; float b=3.121; char *aa,*bb; aa=(char*)a; bb=(char*)b; printf("%d",aa); printf("%u",bb); return 0; }

4th Apr 2017, 2:07 PM
vimal tomar
vimal tomar - avatar
8 ответов
0
Its like converting floats and integers to char
4th Apr 2017, 5:57 PM
Fuat Seven
Fuat Seven - avatar
0
You need to add this conversion if you want to assign an integers address to a char pointer otherwise you will get compiler error
4th Apr 2017, 5:59 PM
Fuat Seven
Fuat Seven - avatar
0
when you print aa it will give you same data
4th Apr 2017, 6:00 PM
Fuat Seven
Fuat Seven - avatar
0
is it like type casting a pointer??
4th Apr 2017, 10:39 PM
vimal tomar
vimal tomar - avatar
0
what does it basically do to our char pointer??
4th Apr 2017, 10:39 PM
vimal tomar
vimal tomar - avatar
0
a variable is an integer aa pointers type is char that line converts a to char if you print aa pointer in %c it will show you a character from the ASCII code which is equal to a's value
4th Apr 2017, 10:42 PM
Fuat Seven
Fuat Seven - avatar
0
you cant assign a char pointer to int variable so that line basically converted a to char and printed a's value as decimal as you see in printf %d
4th Apr 2017, 10:43 PM
Fuat Seven
Fuat Seven - avatar
0
it is same with defining an integer type aa pointer and assigning it with integer a
4th Apr 2017, 10:44 PM
Fuat Seven
Fuat Seven - avatar