VC++ error C2664

问题描述
error C2664: ‘CreateBiTree’ : cannot convert parameter 1 from 'struct BiTnode ** ’ to 'struct BiTNode ** ’
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

代码

// 实验三.cpp : Defines the entry point for the console application.
//

#include<stdafx.h>
#include"stdio.h"
#include"stdlib.h"
typedef char TElemType;
typedef struct BiTNode
{
   
	TElemType data;
	struct BiTnode *lchild,*rchild;
}BiTNode,*BiTree;

void  CreateBiTree(BiTree *T)
{
   
	TElemType ch;
	scanf("%c",&ch);
	if(ch==' ')
		*T=NULL;
	else
	{
   
		*T=(BiTree)malloc(sizeof(BiTNode));
			if(!*T)
				exit(-1);
			(*T)->data=ch;
			CreateBiTree(&(*T)->lchild);
			CreateBiTree(&(*T)->rchild);
	}
}

void 
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是一个简单的 VC++ 6.0 TCP 服务器程序示例: ```cpp #include <winsock2.h> #include <stdio.h> #pragma comment(lib, "ws2_32.lib") int main() { WSADATA wsa; SOCKET s, new_socket; struct sockaddr_in server, client; int c; char *message; printf("\nInitializing Winsock..."); if (WSAStartup(MAKEWORD(2, 2), &wsa) != 0) { printf("WSAStartup failed. Error Code : %d", WSAGetLastError()); return 1; } printf("Initialized."); if ((s = socket(AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET) { printf("Could not create socket : %d", WSAGetLastError()); } printf("Socket created."); server.sin_family = AF_INET; server.sin_addr.s_addr = INADDR_ANY; server.sin_port = htons(8888); if (bind(s, (struct sockaddr *)&server, sizeof(server)) == SOCKET_ERROR) { printf("Bind failed with error code : %d", WSAGetLastError()); } puts("Bind done"); listen(s, 3); puts("Waiting for incoming connections..."); c = sizeof(struct sockaddr_in); while ((new_socket = accept(s, (struct sockaddr *)&client, &c)) != INVALID_SOCKET) { puts("Connection accepted"); message = "Hello Client, I have received your connection. But I have to go now, bye\n"; send(new_socket, message, strlen(message), 0); closesocket(new_socket); } if (new_socket == INVALID_SOCKET) { printf("accept failed with error code : %d", WSAGetLastError()); return 1; } closesocket(s); WSACleanup(); return 0; } ``` 此示例创建了一个 TCP 服务器,它侦听来自客户端的连接,并向客户端发送一条消息,然后关闭连接。你可以根据自己的需求来修改这个示例。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值