cost 411 ms
为什么我能够打印 sizeof 变量,即使我没有在 C 中初始化它们? - Why am I able to print the sizeof variables even though I have not initialised them in C?

我试图了解当在 main function 中声明时,一个变量在 C 中准确获得 memory 的时间。我发现了一个类似的问题When does memory gets allocated for a variable in c? 这里。 它提到分配memory时没有硬性规定。 但我正在尝试具体了 ...

C 中的 Arrays。sizeof() 的工作原理,我在哪里可以找到它的声明,数组的实际创建方式以及我在哪里可以找到源代码 - Arrays in C. How sizeof() works, where I can find its declaration, how an array is actually created and where I can find that source code as well

sizeof() 如何计算出 array1 是 3 个字节而不是 4 个字节,因为我给分配给数组的 memory 的第 4 个字节分配了一个值? array2[-1] = 3 //3存储在这个位置,因此4字节字中的所有字节都在其中有一个值。 那么 //sizeof(array1) 如何返回值 3 ...

修改itoa,将带小数点运算符的浮点字符串处理成output中的ASCII char 23(123.456) - Modify itoa to process a floating point string with decimal point operator into ASCII char 23(123.456) in the output

遇到麻烦 C 语言调试步骤进入浮点数字字符串中的过程小数点运算符。 示例:1234.5678,itoa() output 在 4 处停止并以 '\0' 终止数组字符串 Null char* 指针也是一个数组。 因此,即使在为 '.' 添加测试之后,我们也只会在 out 数组中得到 1234\0 似 ...

给定一个 char 指针,函数应该返回指针指向的字符串的长度 - Given a char pointer, the function should return the length of the string pointed to by the pointer

编辑:我是新来的。 如果我的问题没有正确提出,我将不胜感激您的反对意见。 谢谢你。 我有这个练习: .... 给定一个 char 指针,该函数应返回指针指向的字符串的长度。 约束: 不要使用 Array 下标运算符('[ ]'),使用 Dreference 运算符('*')。 不要使用数字计数器, ...

是否有可靠的方法来检查 C++ 数据类型、大小及其最小和最大限制 - Is there a solid way of checking a c++ data-type's, size and its minimum and maximum limits

由于 c++ 数据类型的大小和限制可能因体系结构而异,我想确保它们的保真度。 我在下面分享的第二个代码块,我如何检查它们,但感觉不对。 我觉得它不会在每个系统上工作(即使在我的电脑上工作)。 有没有更好的方法来检查 C++ 数据类型的字节大小及其最小和最大限制这些是我在整个项目中使用的数据类型(使用 ...

这个基于位域的结构如何计算 1. 结构的大小 2. 指针值之间的差异? - How is this bit fields based structure calculating 1. the structure's size 2. the difference between pointer values?

代码 Output: 我在期待分配给 x 的 4 个字节由于 long int 是位域化的,因此分配给它的是 33 位 -> 4 + 4 字节,但只使用了 33 位然后将 4 个字节分配给 z,并且不会占用前 8 个字节中的剩余空间,因为没有剩下 4 个完整的字节。 总共 16 个字节, ...

我的 c 程序中出现“arguments 太少无法运行”错误 - I'm having problems with a “too few arguments to function” error in my c program

我从 Boris Allen 的书 C programming: principles & practice on pg18 using Dev-C++ 5.11 中输入了这个程序,它应该产生以下 output 文本: 我不知道如何解决这个错误。 (编译器还在“main”中提到了带有 fu ...

编译器从 function 参数的数组中获取多少元素? - How many elements does the compiler take from an array which is function argument?

我听说当使用数组作为 function 参数时,编译器将其视为实际上不是数组,而是作为指向数组第一个元素的指针。 因此,当询问 A(int array) 的大小时,它应该返回指针 4 的大小(以字节为单位)。 但我得到8。有什么问题? 我正在使用代码块。 ...

sizeof() 如何与取消引用一起工作? - How does sizeof() work with a dereference?

我最近看到的一个代码示例: sizeof(*ptr)甚至如何工作? 如何取消引用未定义的指针并将其提供给sizeof()并产生正确的大小? (当然它应该导致未定义的行为,因为它未定义) 最后,C 标准是否定义了这种行为? (也许表明它在 C 中是合法的,我找不到任何东西) ...

为什么大小不一样? 数组的 sizeof(a) vs sizeof(&a)? - Why the size differs? sizeof(a) vs sizeof(&a) of an array?

对于下面的代码。 output 是 'a' 代表整个数组(也是数组的第一个元素的地址,因为它是一维数组),sizeof(a) 代表整个数组的大小。 因此大小是 16。明白了。 '&a' 代表整个数组的地址,而sizeof(&a) 代表什么? 我猜它的 output 是 8 因 ...


 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM