// chenwenjun.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <iostream>
#include <list>

//.........结构体指针的使用 和 list缓存指针
//struct Test
//{
// int len;
// char* point;
//};
//
//class A
//{
//public:
// A(){}
// ~A(){}
//
// void push();
// void pop();
//private:
// std::list<Test*> test_list_;
//};
//
//
//void A::push()
//{
// Test* test = new Test;
// test->len = 1995;
// test->point = new char[1995];
// test_list_.push_back(test);
//}
//
//void A::pop()
//{
// Test* test = test_list_.front();
// std::cout << test->len << std::endl;
//}
//
//int main()
//{
// A a;
// a.push();
// a.pop();
//
// system("pause");
//}

//...........二级指针申请内存,相当于二维数组
//struct A
//{
// int a;
//};
//
//int main()
//{
// A* a = new A[100];
// a[2].a = 100;
// //a[101].a = 101;
//
// A** aa = (A**) new int[100];
// for (int i = 0; i< 100; i++)
// {
// aa[i] = new A();
// }
// //aa[99][998].a = 1;
// aa[0][2000].a = 1;
//
//
// std::cout << a[2].a << std::endl;
// std::cout << aa[0][2000].a << std::endl;
// system("pause");
//}

//...................若想改变指针的地址需要传 二级指针 或者 一级指针的引用
// void test(char *p)
//
// {
//
// printf("[test1][p]:%p.\n", p);
//
// printf("[test2][p]:%s.\n", p);
//
// p = (char *)malloc(10);
//
// strcpy(p, "ABCDE");
//
// printf("[test3]malloc之后.....\n");
//
// printf("[test4][p]:%p.\n", p);
//
// printf("[test5][p]:%s.\n", p);
//
// free(p);
//
// }
//
//
//
// int main()
//
// {
//
// char b[6] = "abcde";
//
// char *a = b;
//
// printf("[main1][a]:%p.\n", a);
//
// printf("[main2][a]:%s.\n", a);
//
// test(a);
//
// printf("[main3][a]:%p.\n", a);
//
// printf("[main4][a]:%s.\n", a);
//
//
// system("pause");
// return 0;
//
// }

//......对象无法访问私有析构函数, list内是指针时,需要对迭代器取*
// struct S
// {
// int a;
// };
//
//
// class A
// {
// public:
// A() {
//
// }
// private:
// ~A()
// {
// std::cout << "ok...!\n";
// }
//
// };
//
// int main()
// {
// std::list<S*> s_list_;
// S s;
// s_list_.push_back(&s);
//
// for (std::list<S*>::iterator iter; iter != s_list_.end(); iter++)
// {
// S* s = *iter;
// std::cout << s->a << std::endl;
// std::cout << (*iter)->a << std::endl;
// }
//
//
//
// return 0;
// }

//..........int型强赋值给char型后会发生什么
// int main()
// {
// char a[10];
// a[0] = 2;
// //printf("%d\n", a[0]);
//
// if (2 == a[0])
// {
// std::cout << (int)a[0] << std::endl;
// printf("%d\n", a[0]);
// }
// system("pause");
// }
//........... 长字节赋给短字节有可能会被截断,例如char是一个字节,int为4个字节,
// 2在内存中其实是 00000000 00000000 00000000 00000010,char只获取 00000010,因此还没被截断,
// 超过255就会被截断。std::cout会默认匹配类型打印,a实际是个数组,若只想打印a[0],需要强转int

验证demo的更多相关文章

  1. @valid表单验证demo

    springMVC 表单验证demo  视图层使用的是jsp

  2. spring mvc 建立下拉框并进行验证demo

    原文出处:http://howtodoinjava.com/spring/spring-mvc/spring-mvc-populate-and-validate-dropdown-example/ 该 ...

  3. python_appium 之使用Appium Inspector定位工具进行元素识别,编写验证demo

    一.前提条件 appium环境搭建完成,模拟器Genymotion 安装完成,且已经下载成功了模拟设备 二.元素识别操作步骤及demo 1.进入appium如下菜单 2.填写Desired Capab ...

  4. struts2学习笔记--拦截器(Interceptor)和登录权限验证Demo

    理解 Interceptor拦截器类似于我们学过的过滤器,是可以在action执行前后执行的代码.是我们做web开发是经常使用的技术,比如权限控制,日志.我们也可以把多个interceptor连在一起 ...

  5. Django通过中间件实现登录验证demo

    前提:中间件版的登录验证需要依靠session,所以数据库中要有django_session表. from django.conf.urls import url from django.contri ...

  6. 文件完整性hash验证demo(python脚本)

    一个简单的文件完整性hash验证脚本 #!/usr/bin/env python # -*- coding: utf- -*- import os import hashlib import json ...

  7. angular1 表单验证demo

    这是一个angular1 验证表单的小栗子: 先看代码: <div ng-controller="myController"> <form name=" ...

  8. 邮箱格式验证demo

    <html> <head> <script type="text/javascript"> function validate_email(fi ...

  9. JS表单验证-12个常用的JS表单验证

    JS表单验证-12个常用的JS表单验证 最近有个项目用到了表单验证,小编在项目完结后的这段时间把常用的JS表单验证demo整理了一下,和大家一起分享~~~ 1. 长度限制 <p>1. 长度 ...

随机推荐

  1. Python之字符串函数str()

    str()方法使Python将非字符串值表示为字符串: age = 23 message = "Happy" + str(age) +"rd Birthday"

  2. abaqus python库变强变大233333333333333

    有没有小伙伴想在 至于怎么安装pip 度小娘一位大神提供了办法  https://jingyan.baidu.com/article/7e4409533f32092fc0e2ef24.html 如有需 ...

  3. VM安装centos7

    镜像:笔者采用的是CentOS-7-x86_64-Minimal-1810.iso版本 1.创建新的虚拟机 2.典型安装与自定义安装 典型安装:VMwear会将主流的配置应用在虚拟机的操作系统上,对于 ...

  4. Arch Linux 硬盘引导-联网安装

    Arch Linux 硬盘引导-联网安装 ============https://www.archlinux.org/https://wiki.archlinux.org/https://wiki.a ...

  5. vue集成环信IM

    vue 集成环信im 简单demo 环信AppKey:1106190415055331#test 测试账号: test1  123456  test2  123456  test3  123456 默 ...

  6. 2.go的变量和常量

    go的变量和常量 GO的变量: 变量的声明:  先对变量进行声明,在对其赋值 var variableName type variableName = typeValue var number int ...

  7. 关于使用git上传远程仓库的两种情况(新项目与老项目)

    具体的git配置与github仓库ssh配置在这里就不再赘述,本次只讲自己之前遇到的两个内容 1.还没有项目,将远程仓库clone下来直接在里边写项目. 2.已有项目,将已有的项目直接添加到建立好的远 ...

  8. [SQL] 从文本中提取数值

    现需求从上方测试数据的“备注”列中提取出金额 目前有两个方法比较容易实现: 1.首先比较容易想到的就是利用函数stuff删除掉所有的非数值字符. STUFF ( character_expressio ...

  9. xamarin android 文件选择

    调出选择界面: Intent intent = new Intent(Intent.ActionGetContent); intent.AddCategory(Intent.CategoryOpena ...

  10. JavaWeb之搭建自己的MVC框架

    https://blog.csdn.net/anita9999/article/details/83378111 自己写一个mvc框架吧(一) https://www.cnblogs.com/heba ...