Can somebody help me please?☺️ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can somebody help me please?☺️

hello to everyone. i have some exercises in C, but because i am a beginner, i don't know if th answers i give are right or wrong. can someone help me please? exc1. i should find the value of x and y each time int x=5; int y=3; ++x; // the value of x will be 6 y=--x; //the value of x and y will be 5 y+=x--; //the value of x will be 5 and the value of y will be 10 y-=x++; //the value of x will be 4 and the value of y will be 6 ex3 what should be the value of a[4] when: int 1, a[5]; //will exist a[0], a[1], a[2], a[3], a[4], a[5] for (i=0;i++) a[i]=4-i; //a[0]=4-0=4, a[1]=4-1=3 , a[2]=4-2=2, a[3]=4-3=1, a[4]=4-4=0 for((i=0;i++) a[i]=a[a[i]]; //So a[0]=a[a[0]]=a[4]=0 ==>a[0]=4 ex4 what will print if we vall the func(5,15)? int func(int a, int b) { int i; i=a; //i=5 if (i<b){ //indeed i<b (5<15) i+=func(2*i,b); //i=i+2*i printf("%d",i); //==> i=5+2*5=15 return(1); } return(0); printf("%d\n",a);} exc5 i)what is going to print the below code? int *num_ptr, num; num=20; num_ptr= &num; printf("%d\n,num_ptr);

7th Sep 2019, 11:29 AM
Elisecho
Elisecho - avatar
4 Answers
+ 3
you could just put it into an ide 🤷‍♂️😅 and print the values after each line
7th Sep 2019, 11:43 AM
Anton Böhler
Anton Böhler - avatar
+ 3
Or you just do that in the Code Playground.
7th Sep 2019, 11:47 AM
HonFu
HonFu - avatar
+ 2
Well, write the solutions on paper - and then run the code and see how many of your answers were correct.
7th Sep 2019, 12:02 PM
HonFu
HonFu - avatar
0
yes, i agree with you but i should do this exercises in the paper not in a ide. so i should now if those answers are correct or no.
7th Sep 2019, 11:57 AM
Elisecho
Elisecho - avatar