URI:
   DIR Return Create A Forum - Home
       ---------------------------------------------------------
       techsuns
  HTML https://techsuns.createaforum.com
       ---------------------------------------------------------
       *****************************************************
   DIR Return to: OutPut of a Program
       *****************************************************
       #Post#: 481--------------------------------------------------
       What is the ouput of both the programs? 
       By: kranthipls Date: March 26, 2013, 10:59 am
       ---------------------------------------------------------
       [code]#include <stdio.h>
       int main()
       {
       int i = 5, j = 10, k = 15;
       //Assume 32 bit architecture
       printf("%d ", sizeof(k /= i + j));
       printf("%d", k);
       return 0;
       }
       [/code]
       [code]#include <stdio.h>
       int main()
       {
       //Assume sizeof character is 1 byte and sizeof integer is 4
       bytes
       printf("%d", sizeof(printf("GeeksQuiz")));
       return 0;
       }[/code]
       #Post#: 482--------------------------------------------------
       Re: What is the ouput of both the programs? 
       By: kranthipls Date: March 28, 2013, 12:44 am
       ---------------------------------------------------------
       Please execute it and see. The answer may not be what you are
       expecting.
       #Post#: 483--------------------------------------------------
       Re: What is the ouput of both the programs? 
       By: adi Date: March 28, 2013, 4:04 am
       ---------------------------------------------------------
       1. since we do integer division the output of first is an
       integer ie [font=dejavu sans mono]k /= i + j is an integer and
       so sizeof int gives 4. and k =15 [/font]
       [font=dejavu sans mono][/size][/font]
       [font=dejavu sans mono][/size][/font]
       [font=dejavu sans mono][/size]2. printf returns integer so again
       sizeof gives 4 [/font]
       *****************************************************