现在我已经熟悉了C和C标准库,我想知道当我转向以后使用C++时,我在这方面的知识是否有用.
因此,我想知道,我是否可以在C++设置中使用C标准库提供的功能,以及是否以及为什么实际这样做是有意义的.
我想问一下C变量是如何存储在C中的?
要更清楚地考虑以下代码:
int main() {
int a = 1, b;
b = a + 2;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
例如,在这里,存储器C存储可变位置的名称.
例如,如果&a=0x12A7
(假设)&b=0x123B1
,那么c如何以及在何处存储变量名称,例如存储内存名称a
?
我最近从项目网站下载并安装了C的Cairo图形库.
我尝试使用网站常见问题解答中的给定代码来运行开罗的hello world程序.在Terminal中,我应用了同一页面给出的相同命令来编译它.但是当我尝试编译它时,出现了未定义引用的错误.
在终端中,输出是:
cc -o hello $(pkg-config --cflags --libs cairo) hello.c
/tmp/cco08jEN.o: In function `main':
hello.c:(.text+0x1f): undefined reference to `cairo_image_surface_create'
hello.c:(.text+0x2f): undefined reference to `cairo_create'
hello.c:(.text+0x4e): undefined reference to `cairo_select_font_face'
hello.c:(.text+0x6d): undefined reference to `cairo_set_font_size'
hello.c:(.text+0x89): undefined reference to `cairo_set_source_rgb'
hello.c:(.text+0xbb): undefined reference to `cairo_move_to'
hello.c:(.text+0xcc): undefined reference to `cairo_show_text'
hello.c:(.text+0xd8): undefined reference to `cairo_destroy'
hello.c:(.text+0xe9): undefined reference to `cairo_surface_write_to_png'
hello.c:(.text+0xf5): undefined reference to `cairo_surface_destroy'
collect2: error: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)
我的源代码是:
#include <cairo.h> …
Run Code Online (Sandbox Code Playgroud) 我正在读的方式,整数如何存储在c中的变量中,最后一位用于整数的符号,其余的位用于存储数字.
但是如果我们在c中取一个double变量和long int变量,两者都有4个字节的大小,但是float可以存储非常大的数字,最大可以达到10 38,但是相同大小的long int不能存储这么大的值.
我想了解浮动存储中使用的机制.
我知道,我们可以在 Linux 中安装应用程序的软件包有很多种,例如 .rpm、.deb、.tar.gz 等。那么有多少种这样的软件包类型,请给出它们的列表,也请提供给出从他们安装的方式。
我也在网上学习过,但无法全部理解。