1、生成动态链接库[root@typhoeus79 c]# more head.c #include #include typedef struct _point{ int x; int y;}Point;Point * InitPoint(int x,int y){ Point ...
分类:
编程语言 时间:
2014-06-18 15:45:00
阅读次数:
267
在同一个结构体中,定义不同的构造函数,如果传值类型相同,但是外部名称不一样,可以当做不同的构造函数,这就java的区别很大,例子如下:struct Celsius { var temperatureIC: Double = 0.0 init(fF fahrenheit: Double){ ...
分类:
其他好文 时间:
2014-06-18 15:32:04
阅读次数:
181
用途一:定义一种类型的别名,而不只是简单的宏替换。可以用作同时声明指针型的多个对象。比如:char* pa, pb;//这多数不符合我们的意图,它只声明了一个指向字符变量的指针,//和一个字符变量;以下则可行:typedef char* PCHAR;PCHAR pa, pb;这种用法很有用,特别是c...
分类:
其他好文 时间:
2014-06-18 10:37:47
阅读次数:
211
引言:数据经常以成组的形式存在。在C中,使用结构可以把不同类型的值存放在一起。
结构的声明有两种
1、struct SIMPLE{
int a;
char b;
float c;
};然后用标签SIMPLE去声明结构体变量。
2、typedef struct{
int a;
char b;
float c;
}Simple;然后用Simple去声明结构体变量。此时Simple...
分类:
编程语言 时间:
2014-06-17 23:22:29
阅读次数:
200
#import
typedef struct students{
}Stu;
int main(int argc, const char * argv[])
{
//结构体,里面的是成员(变量)
struct teacher {
char name[30];
char sex;
int age;
...
分类:
编程语言 时间:
2014-06-17 22:48:22
阅读次数:
324
矩阵的秩
typedef int Matrix[maxn][maxn];
int rank(Matrix A, int m, int n)
{
int i = 0, j = 0, k, r, u;
while(i < m && j < n)
{
r = i;
for(k = i; k < m; k++)
if(A[k][j])
{
r = k;
brea...
分类:
其他好文 时间:
2014-06-17 19:03:00
阅读次数:
210
bool CDlgResetAlarmInfo::GetLocalUserNameAddIP(CString &a_lstrUserName ,CString &a_IpStr)
{
char buf[256]="";
WSADATA w;
WSAStartup(0x0101, &w);
struct hostent *ph = 0;
gethostname(buf, 256)...
分类:
编程语言 时间:
2014-06-17 16:38:03
阅读次数:
223
#include#includeusing namespace std;struct Food{ double x,y;}food[1005]; int cmp(Food i,Food j){ return i.x*j.y>j.x*i.y;}int main(){ double s,m; int i...
分类:
其他好文 时间:
2014-06-17 15:31:19
阅读次数:
160
#include "stdafx.h"#include "stdlib.h"typedef struct Node{ int data; struct Node* next;} LinkNode;void PrintNodes(LinkNode *&List){ LinkNode ...
分类:
其他好文 时间:
2014-06-17 15:25:14
阅读次数:
158
简单来说,就是二叉树的前序、中序、后序遍历,包括了递归和非递归的方法前序遍历(注释中的为递归版本): 1 #include 2 #include 3 #include 4 #include 5 6 using namespace std; 7 8 struct TreeNode 9 {1...
分类:
其他好文 时间:
2014-06-17 12:53:42
阅读次数:
416