Can you explain these c codes?
char *fun(){ char *temp = "Crazy Engineers"; return temp; } int main(){ puts(fun()); }2. What is the meaning of the +i in the following code? What will be the output? The program don't give a compiler error.
main(){ int i=-1; +i; printf("%d %d",i,+i); }3. What function of x and n is computed by the code segment? And the answer is x^n.
Can you explain how to calculate it quickly?
int foo ( int x , int n){ int val=1; if(n>0){ if (n%2 == 1) val = val *x; val = val * foo(x*x , n/2); } return val; }4. The output of the following program is "Hell". Can you explain how?
main (){ unsigned i=3; cirscr(); if(i>-1) printf("Hell'); else printf("Heaven"); }5.The output of the following program is 256. Can you tell me how?
main(){ unsigned char i=0x80; printf("\n%d",i<<1); }6.The output of the following code is "ligent". Can you explain why?
main(){ printf(5+"Intelligent"); }7. What will be the output of the following program? It is given as 2 5. Why a+1 don't give an error?
main(){ int a[5] = {1,2,3,4,5}; int *ptr = (int*)(&a+1); printf("%d %d" , *(a+1),*(ptr-1)); }