当前位置:网站首页>Sequential representation of linear tables
Sequential representation of linear tables
2022-06-13 09:25:00 【Hezeze】
Dynamically distributed one-dimensional array , Using structures and pointers .
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
typedef struct {
int a;
float b;
} array;
typedef struct {
array *elem;
int length;
}SqList;
int main (void) {
SqList L;
int i=0;
L.elem=(array *)malloc(sizeof(array)*2 );
L.elem->a=1;
L.elem->b=3.2;
(L.elem+1)->a=2;
(L.elem+1)->b=6.4;
printf ("%d %f\n",L.elem->a,L.elem->b);
printf ("%d %f",(L.elem+1)->a,(L.elem+1)->b);
free(L.elem);
}
边栏推荐
- C language: deep understanding of pointers and arrays
- 马斯克的「元宇宙」梦
- acwing 786. Number k
- Simple use of spiel expressions
- JS【中高级】部分的知识点我帮你们总结好了
- 攻防世界PWN play 条件竞争漏洞的利用
- Can the operation of the new BMW I3 meet the expectations of the famous products of the 3 series?
- 【最全面详细解释】背包问题详解
- LeetCode 6095. 强密码检验器 II
- Dynamic display of analog clock using digital clock in turtle Library
猜你喜欢

Alibaba senior experts analyze the standard design of protocol

Can the operation of the new BMW I3 meet the expectations of the famous products of the 3 series?

20211020 academician all drive system

(state compression dp+ binary) acwing 91 Shortest Hamilton path

How Simulink adds modules to the library browser

acwing 789. Range of numbers (dichotomy + suitable for understanding dichotomy boundary)

C language: preprocessing in program environment

BGP 联邦+Community

Yolov5 face learning notes

CAS NO lock
随机推荐
7-3 virus traceability (20 points)
LeetCode 6098. Count the number of subarrays whose score is less than K (prefix and + binary search)
LeetCode 1. Sum of two numbers
Resolve importerror:lib*** so--cannot open shared object file: No such... (pycharm/clion reports an error but the shell does not)
Sort() sort function
(bfs) acwing 844. Labyrinth
SpEL表达式 简单使用
LeetCode 202. Happy number
C language: dynamic memory management
20220606 Young's inequality for Matrices
Final principle
acwing 789. Range of numbers (dichotomy + suitable for understanding dichotomy boundary)
C # introductory series (XIII) -- getting to know the structure for the first time
Use typescript to complete simple snake eating function
Delete soft link
Acwing785. quick sort (sort+ quick sort + merge sort)
C language 7-13 day K candle chart (15 points)
Simulink variant model and variant subsystem usage
A static variable is associated with a class and can be used as long as the class is in memory (the variable does not exist as long as your application terminates). (heap body, stack reference)
LeetCode 5259. Calculate the total tax payable