C programming Basic 2


int main(x)
int y,z;

printf("%d",x = pow(z,y));


output :- 9i

Please explain how 'x' is taking some int value
Last edited on
Your code has undefined behavior because variables y and z were not initialized.

Sorry, I am wrong

You defined the main incorrectly. x has usually initial value of 1. z got the number of output symbols.

So you have

x == 1;

( y=-~x ) == 2;

( z=printf("hi\r"); ) == 3

( x = pow(z,y) ) == pow( 3, 2 )
Last edited on
Yeah I got it . But I didn't get that why x 'in the main' >> (main(x)) get value 1??

I have to remeber this or you have idea about this??

Thanks for reply
Because according to the C/C++ standards the first parameter of the main is assigned the number of passed parameters by environment. Usually the first parameter is the full file specification of your program. You can check this by running the following code

#include <stdio.h>

int main( int argc, char *argv[] )
   printf( "%s\d", argv[0] );
Last edited on
Please visit the Site [URL="http:\\contest.collectiva.in\training\Fundame ntalsofC.aspx"]Collectiva[/URL] To learn Fundamentals of C Programming online Video Training in Tamil. It is very useful for the Beginners. Very soon the Video Training in English will be uploaded.
Topic archived. No new replies allowed.