i) Have a look at the following piece of code and state and explain the output. #include int main() { // your code goes here int a = 10, b = 20; int *p = &a; *p = b; printf("%d", a); return 0; } ii)...



 i)
Have a look at the following piece of code and state and explain the output.



#include



int main() {


            // your code goes here


            int a = 10, b = 20;


            int *p = &a;


            *p = b;


            printf("%d", a);


            return 0;


}




ii)
Have a look at the following piece of code and state and explain the output.



#include



void fun(int *a, int *b){


            a = b;


            b = a;


}



int main(void) {


            // your code goes here


            int a = 10, b = 20;


            fun(&a, &b);


            printf("a: %d\n", a);


            printf("b: %d\n", b);


            return 0;


}




iii)
Have a look at the following piece of code and state and explain the output.



#include



int main() {


            // your code goes here


            char s[20] = "abc";


            if(strcmp(strcpy(s, "def"), "abcdef"))


                        printf("Hi");


            else


                        printf("Bye");


            return 0;


}





iv)
Have a look at the following piece of code and state and explain the output.



#include



int main() {


            // your code goes here


            char s[20] = "abcdef";


            strcpy(s, "\0");


            printf("%d", strlen(s));


            return 0;


}







v)
Have a look at the following piece of code and state and explain the output.



#include



int main() {


            // your code goes here


            char *s = "abcdef";


            *(s + 2) = '\0';


            printf("%d", s);


            return 0;


}



Jun 04, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here