首页 > 其他分享 >lecture2

lecture2

时间:2023-06-23 18:13:19浏览次数:29  
标签:lecture2 cowsay argc argv printf include hello

Lecture2 - Arrays

Compiling

  1. 为什么在云端上有cs50这个头文件,在本机上没有?
    在机器的某处存在~/usr/include/cs50.h,但是在本机上没有

  2. 代码编译四步骤

preprocessing 将散列包含行的内容转化为其他内容
compiling 将源代码转化为汇编代码
assembling 将汇编代码转化为机器代码
linking 将多个目标文件链接在一起

debuging

  1. 初始时只使用printf即可解决大部分问题
  2. ide内置debug

command-line Arguments

#include<cs50.h>
#include<stdio.h>

int main(int argc, string argv[])
{
    if (argc == 2)
    {
        printf("hello, %s\n", argv[1]);
    }
    else
    {
        printf("hello, world\n");
    }
}

argv[0]:程序名称
之后的1,2,3……是不同的参数
argc:参数的个数

cowsay

What do you want the cow to say?

cowsay hello, world

cowsay

使用-f参数可以选择不同的动物

cowsay -f duck quack

exit status

ehco $? //查看上一条命令的退出状态(c返回的数字由return决定默认为0)

cryptography

标签:lecture2,cowsay,argc,argv,printf,include,hello
From: https://www.cnblogs.com/viewoverlooking/p/17499452.html

相关文章

  • [CMU 15-418] Lecture2 A Modern Multi-Core Processor
    本系列文章为CMU15-418/15-618:ParallelComputerArchitectureandProgramming,Fall2018课程学习笔记课程官网:CMU15-418/15-618:ParallelComputerArchitectureandProgramming参考文章:CMU15-418notes相关资源与介绍:CMU15-418/StanfordCS149:ParallelComput......
  • cs231n学习笔记——Lecture2 Image Classification
    该博客主要用于个人学习记录,部分内容参考自李飞飞笔记、cs231n计算机视觉课程笔记、图像识别算法(一)、cs231n笔记2—线性分类一、图像识别ImageClassification1、在......
  • 【CS224n】(lecture2~3)Word Vectors, Word Senses, and Neural Classifiers
    学习总结(1)word2vec主要是利用文本中词与词在局部上下文中的共现信息作为自监督学习信号;(2)还有一种稍微古老的估计词向量方法——基于矩阵分解,如在LSH潜在语义分析,手下对预料......
  • Lecture2 Linear methods for regression, Optimization
    书接上回,KNN模型有两个好处,一个是它很简单,另一个就是它既可以用来做回归,又可以用来做分类。但是坏处也很明显,就是它太粗暴了,基本上不怎么学习,只是对数据做一个简单的存储,等......