URI:
   DIR Return Create A Forum - Home
       ---------------------------------------------------------
       techsuns
  HTML https://techsuns.createaforum.com
       ---------------------------------------------------------
       *****************************************************
   DIR Return to: OutPut of a Program
       *****************************************************
       #Post#: 232--------------------------------------------------
       What is the output
       By: ravusairam Date: November 27, 2012, 9:29 am
       ---------------------------------------------------------
       #include<stdio.h>
       #define TOTAL_ELEMENTS (sizeof(array) / sizeof(array[0]))
       int array&#91;] = {23,34,12,17,204,99,16};
       int main()
       {
       int d;
       for(d=-1;d <= (TOTAL_ELEMENTS-2);d++)
       printf("%d\n",array[d+1]);
       return 0;
       }
       #Post#: 237--------------------------------------------------
       Re: What is the output
       By: dada786 Date: November 27, 2012, 9:41 am
       ---------------------------------------------------------
       I think 23, b'cos 'sizeof(array)' is 4.
       #Post#: 241--------------------------------------------------
       Re: What is the output
       By: kpr29 Date: November 27, 2012, 10:12 pm
       ---------------------------------------------------------
       No. it is not correct the size of array gives Number of elements
       * sizeof int.
       #Post#: 242--------------------------------------------------
       Re: What is the output
       By: srkm009 Date: November 27, 2012, 11:15 pm
       ---------------------------------------------------------
       so the value of TOTAL_ELEMENTS will be 7 ..  .. ??
       why is that there is no output at all ??
       #Post#: 243--------------------------------------------------
       Re: What is the output
       By: kranthipls Date: November 27, 2012, 11:18 pm
       ---------------------------------------------------------
       I think all the elements int the array will be printed..........
       #Post#: 245--------------------------------------------------
       Re: What is the output
       By: srkm009 Date: November 27, 2012, 11:25 pm
       ---------------------------------------------------------
       i too expected so....
       but was surprised to c that there was no output at all!! ...
       needs some explanations!!
       #Post#: 246--------------------------------------------------
       Re: What is the output
       By: kpr29 Date: November 27, 2012, 11:26 pm
       ---------------------------------------------------------
       @srkm: The value of TOTAL_ELEMENTS is 7
       Output: 12 17 204 99
       #Post#: 248--------------------------------------------------
       Re: What is the output
       By: kranthipls Date: November 27, 2012, 11:32 pm
       ---------------------------------------------------------
       Very tricky question.............Need to think a lot...........
       Not able to figure out till ravu explained..........
       Hint: Something related to typecasting
       #Post#: 251--------------------------------------------------
       Re: What is the output
       By: kpr29 Date: November 27, 2012, 11:42 pm
       ---------------------------------------------------------
       @Ts: Got it......... missed the -1 initialization of d..........
       nice question....
       #Post#: 253--------------------------------------------------
       Re: What is the output
       By: kranthipls Date: November 27, 2012, 11:58 pm
       ---------------------------------------------------------
       @KP Can you explain what you got it?????????
       *****************************************************
   DIR Next Page