← Back to Index
Research & Engineering Archive

LPC 1. Intro to Programming Computers

By Jingnan Huang · January 08, 2025 · 1178 Words

Last Edit: 1/8/25

1.2 Binary representation in memory
#

Binary to Decimal Number 二进制转十进制
#

Img

Decimal Number to Binary 十进制转二进制
#

Img

Number of Bits to represent x
#

Memory organized way 内存管理方式
#

Img

Hexadecimal & Binary 十六进制和二进制
#

1.4 Write Simple C Programs 编写简单的 C 程序
#

// This program prints the message "Hello World!" on the screen.
##include <stdio.h>

int main(void){
   printf("Hello World!\n");
   return 0;
}

Input 输入
#

##include <stdio.h>

int main(void){
  int numPizzas, numSlices;
  printf("How many pizzas do you have?\n");
  scanf("%d", &numPizzas);
  numSlices = numPizzas * 8;
  printf("You have %d slices in %d pizza.\n", numSlices, numPizzas);
  return 0;
}

pass-by-value 按值传递
#

在 C 语言中,函数的参数传递默认是按值传递(pass-by-value)。这意味着:

Escape Sequences 转义序列
#