从整型转换为长整型

问题描述最近我搜索了int、longint、long、...诸若此类。我从here得到了答案。我发现long和longint是相同的。所以这些声明c=a*long(b);和c=a*longint(b)程序中应相同intmain(){inta=10,b=20;longintc;c=

发布:2023-01-03 标签:intc++long-integertypecasting-operator


C++ 或 Java 中的类型转换和类型转换有什么区别?

问题描述C++或Java中的类型转换和类型转换有什么区别?WhatisthedifferencebetweentypecastingandtypeconversioninC++orJava?推荐答案类型casting将变量引用的值(内存块)视为不同于声明变量的类型.Typecas

发布:2022-10-16 标签:javacastingtype-conversionc++typecasting-operator


C ++或Java中的类型转换和类型转换之间有什么区别?

问题描述在C++或Java中类型转换和类型转换之间有什么区别?WhatisthedifferencebetweentypecastingandtypeconversioninC++orJava?推荐答案类型casting将变量引用的值(内存块)视为与声明该变量的类型不同的类型。T

发布:2022-10-16 标签:javacastingtype-conversionc++typecasting-operator


C:如何访问存储在void指针(void *)中的函数指针?

问题描述对于如何访问存储在void指针(void*)中的函数指针感到困惑.Confusedastohowonecanaccessafunctionpointerstoredinavoidpointer(void*).假设您有这个:void*functions[]={&sqrt,/

发布:2022-10-16 标签:cpointersvoid-pointersfunction-pointerstypecasting-operator


在java中使用null进行类型转换时没有异常

问题描述Stringx=(String)null;为什么此声明中没有例外?Whythereisnoexceptioninthisstatement?Stringx=null;System.out.println(x);打印null。但.toString()方法应抛出空指针异常。I

发布:2022-09-21 标签:javanullpointerexceptiontypecasting-operator


条件运算符“?:”的编译器错误当使用typecasting操作员

问题描述以下代码是最简单的形式:structX{operatorchar()const{return'a';}};intmain(){Xobj,*p=&obj;chara=*p;//okcharc=(true)?*p:'z';}此代码给出编译器错误,错误:操作数?:有不同类型'X

发布:2022-09-19 标签:compiler-errorsc++conditional-operatortypecasting-operator


为什么-Wcast-ALIGN没有警告投从字符*为int * x86上?

问题描述据我所知,GCC有-Wcast对齐选项每当一个指针转换使得所需的目标对准增加,这警告。Iunderstandthatgcchasanoption-Wcast-alignwhichwarnswheneverapointeriscastsuchthattherequireda

发布:2022-09-17 标签:cmemory-alignmentgcc-warningtypecasting-operator