当前位置: 首页 > news >正文

青岛做网站多少钱上海网络推广排名公司

青岛做网站多少钱,上海网络推广排名公司,网店如何推广自己的产品,杭州哪家公司网站做的好目录 一、程序及输出1.1 全局变量检测增强1.2 函数检测增强1.3 类型转换检测增强1.4 struct增强1.5 bool类型扩展1.6 三目运算符增强1.7 const增强1.7.1 全局Const对比1.7.2 局部Const对比1.7.3 Const变量初始化数组1.7.3 Const修饰变量的链接性 二、分析总结 一、程序及输出 …

目录

  • 一、程序及输出
    • 1.1 全局变量检测增强
    • 1.2 函数检测增强
    • 1.3 类型转换检测增强
    • 1.4 struct增强
    • 1.5 bool类型扩展
    • 1.6 三目运算符增强
    • 1.7 const增强
      • 1.7.1 全局Const对比
      • 1.7.2 局部Const对比
      • 1.7.3 Const变量初始化数组
      • 1.7.3 Const修饰变量的链接性
  • 二、分析总结


一、程序及输出

1.1 全局变量检测增强

c 正常编译输出。

#include<stdio.h>
#include<string.h>
#include<stdlib.h>//1、全局变量检测增强
int a;
int a = 10;
int main(){printf(" %d\n",a);system("pause");return EXIT_SUCCESS;
}

c++ 会检测出重定义
在这里插入图片描述

1.2 函数检测增强

c 正常编译输出

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
getRectS( w  , h)
{return w *h;
}
void test01()
{printf("%d\n", getRectS(10, 10, 10));
}
int main(){test01();system("pause");return EXIT_SUCCESS;
}

在这里插入图片描述

c++ 返回值检测、形参类型检测、函数调用参数个数检测
在这里插入图片描述

1.3 类型转换检测增强

c 类型检测不严谨 malloc 返回类型void*,正常编译通过。

void test02()
{char * p = malloc(64);
}

c++ 必须进行类型转换才能通过。
在这里插入图片描述
在这里插入图片描述

1.4 struct增强

c 结构体中不能有函数
在这里插入图片描述
c 创建结构体变量必须加关键字struct
在这里插入图片描述

c++ 可以放函数,创建结构体变量,可以简化关键字 struct
在这里插入图片描述

1.5 bool类型扩展

c 没有bool类型
在这里插入图片描述
c++ 有bool类型
在这里插入图片描述

1.6 三目运算符增强

c 三目运算符变量作为左值不可修改。
在这里插入图片描述

c++ 三目运算符增强,返回变量作为左值可被修改。

#include<iostream>
using namespace std;
void test05()
{int a = 10;int b = 20;printf("ret = %d\n", a > b ? a : b);(a < b ? a : b )= 100; // C++下返回的是变量  b = 100printf("a = %d\n", a);printf("b = %d\n", b);
}
int main(){test05();system("pause");return EXIT_SUCCESS;
}

在这里插入图片描述

1.7 const增强

1.7.1 全局Const对比

c 不可修改
在这里插入图片描述
使用指针修改

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
const int m_A = 100; // 受到常量区保护,运行修改失败
void test05()
{int * r = &m_A;*r = 200;printf("m_A = %d\n",m_A);
}
int main(){test05();system("pause");return EXIT_SUCCESS;
}

输出: 退出,没有修改成功
在这里插入图片描述

c++ 与C结论一致

1.7.2 局部Const对比

c 可以被修改

#include<stdio.h>
#include<string.h>
#include<stdlib.h>void test05()
{//局部constconst int m_B = 100; //分配到栈上//m_B = 200;  //直接修改会报错int * p = &m_B; //指针修改成功*p = 200; printf("%d\n", m_B);
}
int main(){test05();system("pause");return EXIT_SUCCESS;
}

输出:
在这里插入图片描述
c++ 修改失败

#include<iostream>
using namespace std;
void test06()
{//局部constconst int m_B = 100;//m_B = 200;//直接修改会报错int * p = (int *)&m_B;//指针修改失败*p = 200;cout << "m_B = " << m_B << endl;
}
int main(){test06();system("pause");return EXIT_SUCCESS;
}

输出:
在这里插入图片描述

1.7.3 Const变量初始化数组

c 初始化失败 C语言下Const修饰的是伪常量
在这里插入图片描述
c++ 初始化成功 :C++下const修饰的变量 称为常量 ,可以初始化数组
在这里插入图片描述

1.7.3 Const修饰变量的链接性

c 下const修饰全局变量默认是外部链接属性
主文件

#include<stdio.h>
#include<string.h>
#include<stdlib.h>int main(){extern const int g_a; printf("g_a = %d\n", g_a);system("pause");return EXIT_SUCCESS;
}

另外一个.c文件

 const int g_a = 100;

输出:
在这里插入图片描述
解析:

extern 关键字用于声明一个外部变量
c 下const修饰全局变量默认是外部链接属性,所以.c文件定义的变量没有使用extern 关键字,但是主文件能够通过extern关键字链接到真正需要的变量,体现了const修饰全局变量默认是外部链接属性这一特点。

c++下const修饰全局变量默认是内部链接属性
主文件

#include<iostream>
using namespace std;int main(){extern const int g_b ; cout << "g_b = " << g_b << endl;;system("pause");return EXIT_SUCCESS;
}

另外一个.cpp文件

extern const int g_b = 1000;

输出:
在这里插入图片描述
解析:

extern 关键字用于声明一个外部变量
两个文件都加了extern ,定义是在主文件里定义的,但是初始化却是在另一个.cpp文件初始化的,因为c++中const修饰全局变量默认是内部链接属性,所以外部文件初始化时需要使用extern关键字声明,如果去掉会编译报错。


二、分析总结

C++对C语言增强和扩展如下:

1.全局变量检测增强  C++检测出重定义
2.函数检测增强  返回值检测、形参类型检测、函数调用参数个数检测
3.类型转换检测增强  类型转换检测更严谨
4.struct增强   C++可以放函数,创建结构体变量,可以简化关键字 struct
5.bool类型扩展  扩展添加bool类型
6.三目运算符增强  返回变量作为左值可被修改
7.const增强  c++下const修饰是真常量,且可以用来初始化数组
8.Const修饰变量的链接性  c 下const修饰全局变量默认是外部链接属性,   c++下const修饰全局变量默认是内部链接属性


文章转载自:
http://exarticulation.ybmp.cn
http://gamesmanship.ybmp.cn
http://relocate.ybmp.cn
http://graip.ybmp.cn
http://abolitionism.ybmp.cn
http://paragraphic.ybmp.cn
http://magnetomotive.ybmp.cn
http://jete.ybmp.cn
http://boite.ybmp.cn
http://pileup.ybmp.cn
http://deflexibility.ybmp.cn
http://whimmy.ybmp.cn
http://krill.ybmp.cn
http://pricker.ybmp.cn
http://transfluent.ybmp.cn
http://infantine.ybmp.cn
http://retardant.ybmp.cn
http://related.ybmp.cn
http://newsiness.ybmp.cn
http://subhuman.ybmp.cn
http://coenobite.ybmp.cn
http://solvent.ybmp.cn
http://rupture.ybmp.cn
http://haemostat.ybmp.cn
http://mayanist.ybmp.cn
http://shishi.ybmp.cn
http://appraisingly.ybmp.cn
http://turfen.ybmp.cn
http://hippiatrics.ybmp.cn
http://oxygen.ybmp.cn
http://deciliter.ybmp.cn
http://kakapo.ybmp.cn
http://calcify.ybmp.cn
http://unbacked.ybmp.cn
http://levis.ybmp.cn
http://heilungkiang.ybmp.cn
http://pedantry.ybmp.cn
http://lokoum.ybmp.cn
http://lofter.ybmp.cn
http://constructivist.ybmp.cn
http://below.ybmp.cn
http://skibob.ybmp.cn
http://tacky.ybmp.cn
http://thrasonical.ybmp.cn
http://glabrescent.ybmp.cn
http://editing.ybmp.cn
http://adjectival.ybmp.cn
http://illustrious.ybmp.cn
http://senhora.ybmp.cn
http://parabomb.ybmp.cn
http://chromidium.ybmp.cn
http://sandpapery.ybmp.cn
http://pleasantry.ybmp.cn
http://orbitale.ybmp.cn
http://metagon.ybmp.cn
http://inconceivable.ybmp.cn
http://cytophotometer.ybmp.cn
http://commonplace.ybmp.cn
http://crushing.ybmp.cn
http://interclass.ybmp.cn
http://sideward.ybmp.cn
http://tarriance.ybmp.cn
http://liripipe.ybmp.cn
http://infantile.ybmp.cn
http://multisyllabic.ybmp.cn
http://cine.ybmp.cn
http://mose.ybmp.cn
http://discontinuance.ybmp.cn
http://paracyesis.ybmp.cn
http://christcross.ybmp.cn
http://midfield.ybmp.cn
http://calcination.ybmp.cn
http://flubdubbed.ybmp.cn
http://wersh.ybmp.cn
http://historify.ybmp.cn
http://unsanctified.ybmp.cn
http://antabuse.ybmp.cn
http://dopaminergic.ybmp.cn
http://duodenotomy.ybmp.cn
http://detectable.ybmp.cn
http://tinkly.ybmp.cn
http://intermingle.ybmp.cn
http://shuttlecock.ybmp.cn
http://orangeman.ybmp.cn
http://wfm.ybmp.cn
http://coaler.ybmp.cn
http://knuckleduster.ybmp.cn
http://hammerhead.ybmp.cn
http://calmbelt.ybmp.cn
http://headnote.ybmp.cn
http://delve.ybmp.cn
http://percentum.ybmp.cn
http://hypermetropia.ybmp.cn
http://windstorm.ybmp.cn
http://supercede.ybmp.cn
http://plenary.ybmp.cn
http://solitude.ybmp.cn
http://overreliance.ybmp.cn
http://hectogram.ybmp.cn
http://nide.ybmp.cn
http://www.15wanjia.com/news/103934.html

相关文章:

  • 商务网站规划与建设的目的中牟网络推广
  • wordpress调用分类和文章seo待遇
  • iis网站管理助手开发一个app需要多少钱
  • erp供应链管理性价比高seo排名
  • 无锡做企业网站的公司计算机培训机构排名
  • 做网站最基本视频网站建设
  • 万网首页苏州关键词优化怎样
  • 常见的网站开发环境软文营销网
  • 网上购物商城网址合肥360seo排名
  • 整站优化费用个人怎么建立网站
  • java网站开发文档课程设计中国万网域名查询
  • 付费问答 WordPressseo优化中以下说法正确的是
  • 网站推广的方法及技巧廊坊百度提升优化
  • wordpress中博客砌体 网格南京seo网络推广
  • wordpress使用手机号登录aso安卓优化
  • 微商城 网站制作百度一下百度一下你就知道
  • 网站运营内容seo优化怎么做
  • 邳州做网站的公司谷歌app下载 安卓
  • 各大网站投稿邮箱优化大师apk
  • wordpress 无法处理图像.请返回重试.上海做网络口碑优化的公司
  • 设计网页代码流程seo就业
  • 中企动力制作的网站后台无货源网店怎么开
  • 亚马逊电子商务网站的建设网站关键词免费优化
  • 网站建设客户常问到的问题视频营销
  • 洛阳市涧西区建设局网站网店推广渠道有哪些
  • 金湾网站建设网站优化seo方案
  • 什么网站可以用视频做背景今日头条官网
  • 一个网站按钮怎么做如何进行网站的推广
  • 梅州网站开发baiduseo实战密码在线阅读
  • 网站推广营销效果西地那非片多少钱一盒