It only means - If address in hexadecimal is less than 2 digits, it will
add extra padding 0's. If it's more than 2 digits it will simply print the
address as is.
i.e. suppose If address is *E* it will print: *0E* (padding an extra zero)
that's all.
On 21 October 2012 00:05, rahul sharma wrote:
void show_bytes(byte_pointer start, int len)
{
int i;
for (i = 0; i < len; i++)
printf(" %.2x", start[i]);
printf("\n");
}
byte_pointr is unsigned char *...typedef unsigned char * byte_pointer
plz tell me use of %.2x i knowx is for hexadoes it mean print 8
oki.. thanx :)
On Thu, Jun 23, 2011 at 5:39 PM, Ankit Agarwal wrote:
> 1) p1[-3] is an invalid address and thereby, it is giving 0.
>
> 2) p1[3]='e' having 101 as ASCII value, thus -p1[3]=-101 as integer.
>
> On Thu, Jun 23, 2011 at 5:36 PM, Anika Jain wrote:
>
>> 1)
>> int main()
>> {
>> cha
1) p1[-3] is an invalid address and thereby, it is giving 0.
2) p1[3]='e' having 101 as ASCII value, thus -p1[3]=-101 as integer.
On Thu, Jun 23, 2011 at 5:36 PM, Anika Jain wrote:
> 1)
> int main()
> {
> char *p1="cquestionbank";
> printf("%d",p1[-3]);
> return 0;
> }
>
>
> why is
1)
int main()
{
char *p1="cquestionbank";
printf("%d",p1[-3]);
return 0;
}
why is it giving 0??
2)
int main()
{
char *p1="cquestionbank";
printf("%d",-3[p1]);
return 0;
}
why is this giving -101??
--
You received this message because you are subscribed to the Google G