
C 语言
UIUI
注册得早,码龄没有!
展开
-
int* & 求解!
解引用 求解!原创 2024-01-29 17:21:11 · 438 阅读 · 0 评论 -
头文件包含问题。#ifndef
#ifndef 头文件原创 2023-11-21 15:56:15 · 80 阅读 · 0 评论 -
新类型初始化实现。
#include<stdio.h> #include<stdlib.h> typedef void* EHHandle; EHHandle EdgeHandleInit(void) { #define Max 10 static int temp[Max][2] = { 0 }; static int i = 0; if(i< Max) return (int*)temp[i++]; return (int*)-1; } ...原创 2022-03-22 15:11:40 · 464 阅读 · 0 评论 -
单链表反转序列
#define _CRT_SECURE_NO_WARNINGS #include "stdio.h" #include "malloc.h" typedef struct str { unsigned long val; struct str* next; }ListNode; /* 以下代码摘抄,比较好理解。 */ ListNode* reserve(ListNode* cur) { ListNode* prev = NULL; ListNode* temp = NU.原创 2021-11-22 17:20:04 · 770 阅读 · 0 评论 -
学习:C++ 引用
#include "stdio.h" void swapA(int* a, int* b) { int c = 0; c = *a; *a = *b; *b = c; } void swapB(int& a, int& b) { int c = 0; c = a; a = b; b = c; } int main(void) { int a1 = 10, a2 = 20, c1 = 30, c2 = 40; .原创 2021-11-06 14:32:54 · 243 阅读 · 0 评论 -
回调函数!
#include "stdio.h" typedef void (*Ptr) (int a ,int b); void Add(int a, int b) { printf("\na+b = %d", a + b); } void Sub(int a, int b) { (a > b) ? (printf("\na-b = %d",a-b)):(printf("\nb-a = %d",b-a)); } void Mth(int a, int b,Ptr fp) { fp(a,b); }.原创 2021-09-06 14:34:23 · 100 阅读 · 0 评论 -
C 函数指针问题求解。
#include "stdio.h" int(*ptr)(int, int); int Add(int c1, int c2) { return c1 + c2; } void main(void) { int a = 10; int b = 20; int c = 0; c = a; //这里是把a的值赋值给c 了。 /************************/ ptr = &Add; /* 这里看不出 ptr 与 Add 有明显的关系呀? ptr 里的数据也不是 Add.原创 2021-06-03 11:06:22 · 154 阅读 · 1 评论 -
2021-01-28 奇怪代码
int main() { (int [3]) { 7,8,9 }; printf("%d\t", *$S1); printf("%d\t", *$S1+1); printf("%d\t", *$S1+2); return 0; } 好奇怪的代码,留念一下。原创 2021-01-28 08:41:28 · 95 阅读 · 0 评论