Friday, 23 September 2011

C Debugging

                                        HI frd plz attend the question & share the ans 
                                                          (interested person)
1. void main()

{

int const * p=5;
printf("%d", ++(*p));
}


2. main()

{

char s[ ]="man";

int i;

for(i=0;s[ i ];i++)

printf("\n%c% c%c%c",s[ i ],*(s+i),*(i+ s),i[s]);

}



3. main()

{

float me = 1.1;

double you = 1.1;

if(me==you)

printf("I love U");

else

printf("I hate U");

}



4. main()

{

static int var = 5;

printf("%d ",var--);

if(var)

main();

}



5. main()

{

int c[ ]={2.8,3.4,4, 6.7,5};

int j,*p=c,*q=c;

for(j=0;j<5;j++) {

printf(" %d ",*c);

++q; }

for(j=0;j<5;j++){

printf(" %d ",*p);

++p; }

}



6. main()

{

extern int i;

i=20;

printf("%d", i);

}



7. main()

{

int i=-1,j=-1,k= 0,l=2,m;

m=i++&&j++&&k++||l++;

printf("%d %d %d %d %d",i,j,k,l, m);

}



8. main()

{

char *p;

printf("%d %d ",sizeof(*p) ,sizeof(p) );

}

9. main()

{

int i=3;

switch(i)

{

default:printf( "zero");

case 1: printf("one" );

break;

case 2:printf("two" );

break;

case 3: printf("three" );

break;

}

}



10.. main()

{

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

}




No comments:

Post a Comment