hi guys ,
I am a first year student!
can anyone help ..
the code. is .
main()
{
char *b="abc";
printf("%s",b);
}
the output is :abc.
my doubt is :
how can we assign a string constant to a pointer.And when we assign like this is a character array with the name b[] is initialised to "abc"?
and can anyone expalin this program:
#include<stdio.h>
main()
{
char *j="abc";
printf("%u\n%u\n","abc",&"abc");
printf("%u\n%u",j[1],j[0]);
}
and the out put was :
415
419
98
97
please help... :confused:
arun_kumar_c
0
Newbie Poster
Recommended Answers
Jump to Postmy doubt is :
how can we assign a string constant to a pointer.And when we assign like this is a character array with the name b[] is initialised to "abc"?The pointer is assigned the address of an unnamed array which contains the string literal.
and can anyone expalin …
All 4 Replies
Dave Sinkula
2,398
long time no c
Team Colleague
arun_kumar_c
0
Newbie Poster
SpS
34
Posting Pro
SpS
34
Posting Pro
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.