原创 最大子序列和問題

問題描述: 輸入一組整數,求出這組數字子序列和中最大值。也就是隻要求出最大子序列的和,不必求出最大的那個序列。例如: 序列:-2 11 -4 13 -5 -2,則最大子序列和爲20。 序列:-6 2 4 -7 5 3 2 -1 6 -9

原创 C語言中的Trigraph sequences

以下對Trigraph sequences的描述摘自ANSI C標準,一般很少提到和用到。 2.2.1.1 Trigraph sequences    All occurrences in a source file of the fol

原创 C語言中的類型

以下摘自ANSI C標準:    An object declared as type char is large enough to store any member of the basic execution character s

原创 set all bits between i and j in N equal to M

題目: You are given two 32-bit numbers, N and M, and two bit positions, i and j. Write a method to set all bits between i

原创 C語言中的關鍵字

以下摘自ANSI C標準: 3.1.1 Keywords Syntax          keyword: one of          auto     double   int      struct          break 

原创 關於定義爲volatile的變量

定義爲volatile的變量(如volatile int i=10;)主要有兩點: 1.編譯器不能對此變量進行優化,每次需要使用時都從存儲i的地址中取值,而不是使用上次讀取的保存在寄存器中的值; 2.使用場景:一般如果一個變量可能被程序以

原创 C語言中的label

以下摘自ANSI C標準:    A label name is the only kind of identifier that has function scope. It can be used (in a goto stateme

原创 C語言中的枚舉

以下摘自ANSI C標準:    An enumeration comprises a set of named integer constant values. Each distinct enumeration constitutes

原创 整數取反

題目(來自龐果網:http://hero.pongo.cn/):完成函數reverse,要求實現把給定的一個整數取其相反數的功能,舉兩個例子如下: x = 123, return 321 x = -123, return -321 函數實