How to evaluate the following c program? -


#include<stdio.h>   int main() {   int x;   x=~!printf;   printf("%x",x); } 

can 1 explain me process derive output of program.

  • printf pointer printf function - it's integer of sort.
  • ! unary not, meaning returns 0 if operand true, , 1 operand false. since printf true (non-zero, because function defined), subexpression far 0.
  • ~ bitwise complement. flips bits of binary number given. since given 0, return 0xffffffff.
  • that result stored x , printed out in hexadecimal.

on 64-bit machine might instead 0xffffffffffffffff, though i'm not entirely certain.


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -