摘要:[c/cpp]:指向函数的指针数组(函数指针的数组) 〇、说明: 1、 函数指针: 一个指针,它指向一个函数。 2、 函数指针数组: 一个指针数组,它的元素是函数指针。 一、程序代码 1 [root@rocky:test]# cat test.c 2 #include <stdio.h> 3 #in
阅读全文
随笔分类 - c
c语言编程
摘要:[asm]: linux syscall number(32bits_64bits) 一、32bit_syscall_number(451个系统调用) 1 [root@rocky:syscall]# cat linux_syscall_no_32.txt 2 // date: 2024-10-26
阅读全文
摘要:cpp:指针转化(百度AI:static_cast/dynamic_cast/const_cast/reinterpret_cast) 一、 c++ 指针转化概述: 在C++中,指针转换主要包括静态转换、动态转换、常量转换和重新解释转换四种类型。 1、 静态转换(static_cast): -
阅读全文
摘要:[cpp]: I/O -- stream definition One. [ stream picture ] 1. [ picture 1 ] 2. [ picture 2 ] Two. define [ stream ]: stream is an associated character se
阅读全文
摘要:[os] xx.service文件编写 -- systemctl 一、 基本信息 1、 操作系统: Linux rocky 5.14.0-427.16.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Wed May 8 17:48:14 UTC 2024 x86_64 x
阅读全文
摘要:[c/cpp]: 函数的指针和函数数组的指针 一、 函数指针 1、 函数的指针:指向函数的指针,叫做“函数的指针”。 2、 函数数组的指针:指向函数数组的指针,叫做“函数数组的指针”。 二、代码: g++ -std=c++20 -O2 -Wall -pedantic -pthread main.cp
阅读全文
摘要:[cpp]: 常量字符串的声明(const char* const localeName = "zh_CN.utf-8") 一、说明 1、编译环境: g++ prog.cc -Wall -Wextra -I/opt/wandbox/boost-1.83.0-gcc-13.2.0/include -s
阅读全文
摘要:[c][cpp]: c和cpp的命名规则(变量、函数、类、结构、枚举、共用) 一、说明:为了更好识别变量、函数、类、结构体,因此制定命名规则 1、全局变量的命名规则: g_<变量名> 2、函数的命名规则: f_<函数名> 3、【class(类)】的命名规则: c_<类名> 4.1、类的成员变量的命名
阅读全文
摘要:[os]:linux 【系统调用的编号】- SYSCALL_NUMBER 一、基本说明 1、操作系统:fedora38 2、【系统调用的编号】所在路径和名称: [ /usr/include/asm-generic/unistd.h ] 二、系统调用编号的源码【文件路径和名称: /usr/includ
阅读全文
摘要:[cpp][data_structure]: queue -- user defined( bug ) 一、示意 二、源代码中存在的问题 1、 有问题;在pop()中front指针设置有问题。 三、源码 1 #include <iostream> 2 #include <string> 3 4 5
阅读全文
摘要:[c][cpp]: c(cpp) connect to MariaDB -- (Codes) 一、注意事项 1、操作系统: 【 fedora38 】 2、c/cpp 连接 MariaDB数据库,需要使用额外的文件。 3、头文件【 /usr/include/mysql/mysql.h 】:mysql.
阅读全文
摘要:[c][cpp]: C/Cpp connector for MariaDB 一、必要说明 1、【 操作系统 】: 【 fedoral38 】 2、【 mysql.h 】文件位置: 【 /usr/include/mysql/mysql.h 】 二、相关文档 1、 C & C++ Connectors
阅读全文
摘要:[c]: 语言环境设置 -- setlocale() 一、语言环境设置【 Linux - Fedora 】 1、【Linux -- 类redhat 】语言环境设置 1.1、查看语言环境【/etc/locale.conf】:/etc/locale.conf 2、【Linux -- 类debian 】语
阅读全文
摘要:[c][cpp]: decimal to binary 一、源码 1 #include <stdio.h> 2 3 4 // decimal to binary; 10 -> 2 5 void dec2bin(long int num) 6 { 7 int res[1000]; 8 9 long i
阅读全文
摘要:[cpp]: 好玩的“宏定义(macro)” 一、有趣的“宏定义” 1、思想/原理:用【宏macro】,定义【伪指令directive】。 2、命令格式: #define [directive_name] [function or ...] 3、应用实例: 1 // directive entry
阅读全文
摘要:[c]: 计算机编程总结 -- 数据处理 计算机编程,主要工作是数据输入、数据处理、数据输出。在计算机编程中,常见的数据操作有: 一、‘字符串’的处理; 二、‘日期’的处理; 三、‘文件’的读写; 四、‘标准设备’的输入输出。
阅读全文
摘要:[c][cpp]: wchar_t 输出“中文” 一、说明: 0、所用语言:c,编译:gcc -o wchar_t wchar_t.c -std=c2x 1、单个宽字符变量的定义: wchar_t s = L'中' 2、单个宽字符变量的输出控制符: %Lc, %lc 3、多个宽字符数组变量的定义:w
阅读全文
摘要:c/cpp: main() - envp - “本进程”的环境变量 1. main(int argc, char *argv[], char *envp[]) - envp 1.1 argc,自动获取程序的参数的数量; 1.2 argv,自动获取程序输入的参数; 1.3 envp,自动获取“本进程”
阅读全文
摘要:c/cpp: g++ 设置(fedora38) 一、基本配置信息 [wit@fedora null]$ cat /etc/bashrc # /etc/bashrc # System wide functions and aliases # Environment stuff goes in /etc
阅读全文
摘要:c: machine0 - 机器语言的模型机 一、源码 1 [wit@eagle src]$ cat machine0.c 2 #include<stdio.h> 3 #include<stdlib.h> 4 #include<string.h> 5 6 7 8 9 // explains each
阅读全文

浙公网安备 33010602011771号