Reading code

Week 2 Quiz Execute the following code by hand: int anotherFunction(int a, int b) { int answer = 2; int x = 0; printf("In anotherFunction(%d,%d)\n",a,b); while (b > a) { printf("a is %d, b is %d\n", a, b); answer = answer + (b - a); b -= x; a += x / 2; x++; } return answer; } int someFunction(int x, int y) { int a = x + y; if (x < y) { for (int i = 0; i < x; i++) { printf("In the loop with i = %d, a = %d\n", i, a); a = a + x; } } else { y = anotherFunction(y,a+1); } return a * (y-10); } int main(void) { int x = 2; int b = someFunction(3,x); printf("b = %d\n", b); printf("x = %d\n", x); return 0; } Execute main main //setep 1, execute main box, jump to calculate functions in b box. // get result from step 3 in y box, print first 4 lines In anotherFunction(2,6) a is 2, b is 6 a is 2, b is 6 a is 2, b is 5 //step 5, come back to main box, input last step value b=15 //step 6, print last two lines. b=15; x=2; b = someFunction(3,2); ...

2023-11-15 · 2 min · Atom.X

Programming Fundamentals

Original Course link: Programming Fundamentals Week 2 lvalue, rvalue eg. int x = 3; lvalue is x, rvalue is 3 erroneous code for loop = syntactic sugar, it allows you to write more compact code for counting, a common programming idiom(behavior, custom). What does f(5) evaluate to? int f (int n) { int ans = 0; for (int i = 1; i < n; i++) { if (i < n/2) { ans -= i; } else { ans += i; } } return ans; } Hint: dividing integers results in an integer answer. eg. 9/4 = 2, 5/2=2 (四舍五入rounding 3 is wrong) ...

2023-11-12 · 6 min · Atom.X

CS50

CS50x 2023 (harvard.edu) Codespace cs50 User Manual of C C standard library cs50 北美计算机四大本科课程设置: 编程语言学 算法与数据结构 操作系统 计算机网络 数据库 分布式系统 Spoiler tag problem code snippet posted should be posted with spoiler tag pseudocode? description text of ideas <math.h>Functions Set $m/n = (z/q)^x$, m≥n≥2, z>q≥2, x≥0, all arguments are positive integers. how to write an arithmetic function to get x value properly in c programming? could it be like below? ...

2023-11-1 · 1 min · Atom.X

42 School

4 weeks Piscine Piscine blog, how is the 42 school. Prepare for the piscine Ask Us - 42 Berlin Korean guy hack the whole exams. https://github.com/voiddeveloper/Piscine GitHub - ayoub0x1/C-Piscine-exam: Get ready for your 1337/42 exams Basic knowledge Shell, git, Terminal, Vim cd, pwd, ls, touch, mkdir, rm, cat、head、tail, less redirections with chevrons >> and pipes |. https://www.coursera.org/specializations/oss-development-linux-git Linux Shell Scripting Tutorial - A Beginner’s handbook (freeos.com) csh for coder bash shell in Linux ...

2023-10-31 · 1 min · Atom.X

Duke Introductory C Programming

Duke University Open Course Introductory C Programming Specialization It includes four special coursers: Programming Fundamentals Writing, Running, and Fixing Code in C Pointers, Arrays, and Recursion Interacting with the System and Managing Memory Professors speak excellent English, I recommend. if you can not pass Poker game in the final exam of course 3 and 4, please let them away for sometime, after you competing the latter couses, then come back and you can pass them finally. ...

2023-10-31 · 1 min · Atom.X