
c/c++
c/c++中函数 语法的使用
weixin_39446424
c/c++方向
展开
-
C/C++中typedef的使用(类似C++前向声明)
平时开发过程中使用typedef时,该类型(struct class)的变量都已经定义了,所以再使用时无论初始化对象还是指针 引用,都可以正常使用。 但是当使用typedef定义一个只有声明没有定义的一个类型的别名时,我们可以定义这个类型的指针和引用,但是不能定义这个类型的变量,因为定义变量时,会去分配内存,而此时该类型只有声明没有定义,编译时会报错。 这里的使用方式和c++中的前向声明类似 #i...原创 2020-03-06 11:55:20 · 449 阅读 · 0 评论 -
c语言中atoi函数的使用
函数功能 扫描一个字符串的字符,直到第一个不为数字的字符为止,扫描到的字符串转换为数字。若字符串首字母不是数字字符,则返回0 测试程序 #include <iostream> #include <stdlib.h> using namespace std; int main() { cout<<atoi("123456")<<endl; ...原创 2019-12-23 11:46:36 · 823 阅读 · 0 评论 -
使用mqopen mq_receive mq_close和sem_open sem_wait sem_post给不同进程发送任务去执行
mqopen mq_receive mq_close和sem_open sem_wait sem_post联合使用 #include <stdio.h> #include <semaphore.h> #include <mqueue.h> #include <unistd.h> #include <string.h> #include "...原创 2019-11-26 11:23:00 · 313 阅读 · 0 评论