c++基础
mengni123321
这个作者很懒,什么都没留下…
展开
-
bitmap测试
// bitmapTest.cpp : Defines the entry point for the console application. // #include "stdafx.h" const int maxNum = 10000; int data[maxNum/32 + 1]; void clear(){ int i = 0; for (;i <maxNum/32...原创 2020-04-02 11:29:36 · 264 阅读 · 0 评论 -
字符串拷贝
#pragma once #include<stdio.h> #include <assert.h> char *strcpy(char *dest,const char *src) { char *d = dest; assert((dest != NULL&& src != NULL)); // if(dest == NULL|| src == NULL) // { //原创 2015-03-16 21:35:42 · 334 阅读 · 0 评论 -
常量折叠问题
常量折叠说的是,在编译阶段,对该变量进行值替换,同时,该常量拥有自己的内存空间,并非像宏定义一样不分配空间。#include <stdio.h>int main(void) { const int con = 5; printf("%d\n",con); int *ptr; ptr = const_cast<int *> (&con); *ptr =67;原创 2015-03-14 19:31:05 · 393 阅读 · 0 评论 -
栈--出栈和入栈
#include <stdio.h> #include <malloc.h>typedef struct node { int data; struct node *pNext; }node;typedef struct StackLink { node *top; int size; }StackLink;void push(StackLink *S,int num原创 2015-03-14 20:06:49 · 448 阅读 · 0 评论