Month: August 2016

C 字符串处理

首先我们来看下面的代码。这个代码,目的是想对一行字符串(以#符号开始)的注释前后空白进行去除。如“  this is what I want   #this is the comment”, 我想得到“this is what i want”。

首先我们将字符串地址赋值给StrStart, 然后判断是否空白,如果是,则将地址向后移动一位,以此类推,这样找到了非空白字符地址(注意:这里没有删掉buffer前面的空白);

然后我们找到#所在的位置,然后将地址赋值给StrEnd (注意:这个地址是指向这个字符及其之后字符所组成的字符串首地址),然后将该地址所指的字符串复制为’\0’字[……]

Read more

Explict vs Implict FInite Difference Scheme

数值差分方法一般分为显式差分与隐式差分,对二者的区别我查阅了相关的资料。我后面发现关于二者区分不是有一些差异。如Wiki:

Explicit methods calculate the state of a system at a later time from the state of the system at the current time, whileimplicit methods find a solution by solving an equation involving both the current state of the system and the late[……]

Read more