top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What will be the output of below c program?

+3 votes
595 views

1.

main()
{
printf("%x",-1<<4);
}

2.

main()
{
int i=10;
i=!i>14;
Printf ("i=%d",i);
}
posted Mar 28, 2015 by Amit Kumar Pandey

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button
Why don't you try it on any onine C compiler?

1 Answer

+3 votes
  1. Depending on the machine implementation it will result in FFFFFF0 (for 32bit ) or FFF0 (16 bit )

  2. I = 0 . In the expression !i>14 , NOT (!) operator has more precedence than ? >? symbol. ! is a unary logical operator. !i (!10) is 0 (not of true is false). 0>14 is false (zero).

answer Mar 28, 2015 by Tanmoy Debnath
Similar Questions
0 votes
#include<stdio.h>
int main()
{
   int n;
   for(n = 7; n!=0; n--)
     printf("n = %d", n--);
   getchar();
   return 0;
}
+2 votes
void main(){
   int i=320;
   char *ptr=(char *)&i;
   printf("%d",*ptr); 
}

Please provide your explanation also?

0 votes
#include<stdio.h>
main()
{
        int a=10;
        printf("%d\n",a++==a);
}

Output should be 1 but it is coming as 0,
Can anyone please explain?

...