C 结构体

原创 2018年04月17日 21:15:29


内核源码位置:include/linux/fs.h 第852行

struct file {
	union {
		struct llist_node	fu_llist;
		struct rcu_head 	fu_rcuhead;
	} f_u;
	struct path		f_path;
	struct inode		*f_inode;	/* cached value */
	const struct file_operations	*f_op;

	 * Protects f_ep_links, f_flags.
	 * Must not be taken from IRQ context.
	spinlock_t		f_lock;
	enum rw_hint		f_write_hint;
	atomic_long_t		f_count;
	unsigned int 		f_flags;
	fmode_t			f_mode;
	struct mutex		f_pos_lock;
	loff_t			f_pos;
	struct fown_struct	f_owner;
	const struct cred	*f_cred;
	struct file_ra_state	f_ra;

	u64			f_version;
	void			*f_security;
	/* needed for tty driver, and maybe others */
	void			*private_data;

	/* Used by fs/eventpoll.c to link all the hooks to this file */
	struct list_head	f_ep_links;
	struct list_head	f_tfile_llink;
#endif /* #ifdef CONFIG_EPOLL */
	struct address_space	*f_mapping;
	errseq_t		f_wb_err;
} __randomize_layout
  __attribute__((aligned(4)));	/* lest something weird decides that 2 is OK */



struct file_operations {
	struct module *owner;
	loff_t (*llseek) (struct file *, loff_t, int);
	ssize_t (*read) (struct file *, char __user *, size_t, loff_t *);
	ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);
	ssize_t (*read_iter) (struct kiocb *, struct iov_iter *);
	ssize_t (*write_iter) (struct kiocb *, struct iov_iter *);
	int (*iterate) (struct file *, struct dir_context *);
	int (*iterate_shared) (struct file *, struct dir_context *);
	unsigned int (*poll) (struct file *, struct poll_table_struct *);
	long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
	long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
	int (*mmap) (struct file *, struct vm_area_struct *);
	int (*open) (struct inode *, struct file *);
	int (*flush) (struct file *, fl_owner_t id);
	int (*release) (struct inode *, struct file *);
	int (*fsync) (struct file *, loff_t, loff_t, int datasync);
	int (*fasync) (int, struct file *, int);
	int (*lock) (struct file *, int, struct file_lock *);
	ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int);
	unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
	int (*check_flags)(int);
	int (*flock) (struct file *, int, struct file_lock *);
	ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int);
	ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int);
	int (*setlease)(struct file *, long, struct file_lock **, void **);
	long (*fallocate)(struct file *file, int mode, loff_t offset,
			  loff_t len);
	void (*show_fdinfo)(struct seq_file *m, struct file *f);
#ifndef CONFIG_MMU
	unsigned (*mmap_capabilities)(struct file *);
	ssize_t (*copy_file_range)(struct file *, loff_t, struct file *,
			loff_t, size_t, unsigned int);
	int (*clone_file_range)(struct file *, loff_t, struct file *, loff_t,
	ssize_t (*dedupe_file_range)(struct file *, u64, u64, struct file *,
} __randomize_layout;



struct inode {
	umode_t			i_mode;
	unsigned short		i_opflags;
	kuid_t			i_uid;
	kgid_t			i_gid;
	unsigned int		i_flags;

	struct posix_acl	*i_acl;
	struct posix_acl	*i_default_acl;

	const struct inode_operations	*i_op;
	struct super_block	*i_sb;
	struct address_space	*i_mapping;

	void			*i_security;

	/* Stat data, not accessed from path walking */
	unsigned long		i_ino;
	 * Filesystems may only read i_nlink directly.  They shall use the
	 * following functions for modification:
	 *    (set|clear|inc|drop)_nlink
	 *    inode_(inc|dec)_link_count
	union {
		const unsigned int i_nlink;
		unsigned int __i_nlink;
	dev_t			i_rdev;
	loff_t			i_size;
	struct timespec		i_atime;
	struct timespec		i_mtime;
	struct timespec		i_ctime;
	spinlock_t		i_lock;	/* i_blocks, i_bytes, maybe i_size */
	unsigned short          i_bytes;
	unsigned int		i_blkbits;
	enum rw_hint		i_write_hint;
	blkcnt_t		i_blocks;

	seqcount_t		i_size_seqcount;

	/* Misc */
	unsigned long		i_state;
	struct rw_semaphore	i_rwsem;

	unsigned long		dirtied_when;	/* jiffies of first dirtying */
	unsigned long		dirtied_time_when;

	struct hlist_node	i_hash;
	struct list_head	i_io_list;	/* backing dev IO list */
	struct bdi_writeback	*i_wb;		/* the associated cgroup wb */

	/* foreign inode detection, see wbc_detach_inode() */
	int			i_wb_frn_winner;
	u16			i_wb_frn_avg_time;
	u16			i_wb_frn_history;
	struct list_head	i_lru;		/* inode LRU list */
	struct list_head	i_sb_list;
	struct list_head	i_wb_list;	/* backing dev writeback list */
	union {
		struct hlist_head	i_dentry;
		struct rcu_head		i_rcu;
	u64			i_version;
	atomic_t		i_count;
	atomic_t		i_dio_count;
	atomic_t		i_writecount;
	atomic_t		i_readcount; /* struct files open RO */
	const struct file_operations	*i_fop;	/* former ->i_op->default_file_ops */
	struct file_lock_context	*i_flctx;
	struct address_space	i_data;
	struct list_head	i_devices;
	union {
		struct pipe_inode_info	*i_pipe;
		struct block_device	*i_bdev;
		struct cdev		*i_cdev;
		char			*i_link;
		unsigned		i_dir_seq;

	__u32			i_generation;

	__u32			i_fsnotify_mask; /* all events this inode cares about */
	struct fsnotify_mark_connector __rcu	*i_fsnotify_marks;

	struct fscrypt_info	*i_crypt_info;

	void			*i_private; /* fs or device private pointer */
} __randomize_layout;



struct stat {
        mode_t    st_mode;      /* 文件对应的模式,文件,目录等 */
        ino_t     st_ino;       /* inode节点号 */
        dev_t     st_dev;       /* 设备号码 */
        dev_t     st_rdev;      /* 特殊设备号码 */
        nlink_t   st_nlink;     /* 文件的连接数 */
        uid_t     st_uid;       /* 文件所有者 */
        gid_t     st_gid;       /* 文件所有者对应的组 */
        off_t     st_size;      /* 普通文件,对应的文件字节数 */
        time_t    st_atime;     /* 文件最后被访问的时间 */
        time_t    st_mtime;     /* 文件内容最后被修改的时间 */
        time_t    st_ctime;     /* 文件状态改变时间 */
        blksize_t st_blksize;   /* 文件内容对应的块大小 */
        blkcnt_t  st_blocks;    /* 伟建内容对应的块数量 */



struct __dirstream
        void   *__fd;
        char   *__data;
        int    __entry_data;
        char   *__ptr;
        int    __entry_ptr;
        size_t __allocation;
        size_t __size;
        __libc_lock_define (, __lock);
typedef struct __dirstream DIR;



struct dirent  {   
        long  d_ino;              /* inode number 索引节点号 */
        off_t d_off;              /* offset to this dirent 在目录文件中的偏移 */
        unsigned short d_reclen;  /* length of this d_name 文件名长 */
        unsigned char  d_type;    /* the type of d_name 文件类型 */
        char d_name[NAME_MAX+1];  /* filename(null-terminated)文件名,最长255字符 */  



struct _iobuf {
        char  *_ptr;        /* 文件输入的下一个位置 */
        int   _cnt;         /* 当前缓冲区的相对位置 */
        char  *_base;       /* 指基础位置(即是文件的其始位置) */
        int   _flag;        /* 文件标志 */
        int   _file;        /* 文件的有效性验证 */
        int   _charbuf;     /* 检查缓冲区状况,如果无缓冲区则不读取 */
        int   _bufsiz;      /* 文件的大小 */
        char  *_tmpfname;   /* 临时文件名 */
typedef struct _iobuf FILE;



内核源码位置:include/linux/time.h 第188行

struct tm {
	 * the number of seconds after the minute, normally in the range
	 * 0 to 59, but can be up to 60 to allow for leap seconds
	int tm_sec;
	/* the number of minutes after the hour, in the range 0 to 59*/
	int tm_min;
	/* the number of hours past midnight, in the range 0 to 23 */
	int tm_hour;
	/* the day of the month, in the range 1 to 31 */
	int tm_mday;
	/* the number of months since January, in the range 0 to 11 */
	int tm_mon;
	/* the number of years since 1900 */
	long tm_year;
	/* the number of days since Sunday, in the range 0 to 6 */
	int tm_wday;
	/* the number of days since January 1, in the range 0 to 365 */
	int tm_yday;



struct task_struct {
	 * For reasons of header soup (see current_thread_info()), this
	 * must be the first element of task_struct.
         * 因为头加速的原因(查看current_thread_info())这必须是task_struct的第一个元素
	struct thread_info		thread_info;
        /* -1 不可捕获,0 可捕获,>0 停止 */
        /* -1 unrunnable, 0 runnable, >0 stopped: */
	volatile long			state;

	 * This begins the randomizable portion of task_struct. Only
	 * scheduling-critical items should be added above here.

	void				*stack;
	atomic_t			usage;
	/* Per task flags (PF_*), defined further below: */
	unsigned int			flags;
	unsigned int			ptrace;

	struct llist_node		wake_entry;
	int				on_cpu;
	/* Current CPU: */
	unsigned int			cpu;
	unsigned int			wakee_flips;
	unsigned long			wakee_flip_decay_ts;
	struct task_struct		*last_wakee;

	int				wake_cpu;
	int				on_rq;

	int				prio;
	int				static_prio;
	int				normal_prio;
	unsigned int			rt_priority;

	const struct sched_class	*sched_class;
	struct sched_entity		se;
	struct sched_rt_entity		rt;
	struct task_group		*sched_task_group;
	struct sched_dl_entity		dl;

	/* List of struct preempt_notifier: */
	struct hlist_head		preempt_notifiers;

	unsigned int			btrace_seq;

	unsigned int			policy;
	int				nr_cpus_allowed;
	cpumask_t			cpus_allowed;

	int				rcu_read_lock_nesting;
	union rcu_special		rcu_read_unlock_special;
	struct list_head		rcu_node_entry;
	struct rcu_node			*rcu_blocked_node;
#endif /* #ifdef CONFIG_PREEMPT_RCU */

	unsigned long			rcu_tasks_nvcsw;
	u8				rcu_tasks_holdout;
	u8				rcu_tasks_idx;
	int				rcu_tasks_idle_cpu;
	struct list_head		rcu_tasks_holdout_list;
#endif /* #ifdef CONFIG_TASKS_RCU */

	struct sched_info		sched_info;

	struct list_head		tasks;
	struct plist_node		pushable_tasks;
	struct rb_node			pushable_dl_tasks;

	struct mm_struct		*mm;
	struct mm_struct		*active_mm;

	/* Per-thread vma caching: */
	struct vmacache			vmacache;

	struct task_rss_stat		rss_stat;
	int				exit_state;
	int				exit_code;
	int				exit_signal;
	/* The signal sent when the parent dies: */
	int				pdeath_signal;
	/* JOBCTL_*, siglock protected: */
	unsigned long			jobctl;

	/* Used for emulating ABI behavior of previous Linux versions: */
	unsigned int			personality;

	/* Scheduler bits, serialized by scheduler locks: */
	unsigned			sched_reset_on_fork:1;
	unsigned			sched_contributes_to_load:1;
	unsigned			sched_migrated:1;
	unsigned			sched_remote_wakeup:1;
	/* Force alignment to the next boundary: */
	unsigned			:0;

	/* Unserialized, strictly 'current' */

	/* Bit to tell LSMs we're in execve(): */
	unsigned			in_execve:1;
	unsigned			in_iowait:1;
	unsigned			restore_sigmask:1;
	unsigned			memcg_may_oom:1;
	unsigned			memcg_kmem_skip_account:1;
	unsigned			brk_randomized:1;
	/* disallow userland-initiated cgroup migration */
	unsigned			no_cgroup_migration:1;

	unsigned long			atomic_flags; /* Flags requiring atomic access. */

	struct restart_block		restart_block;

	pid_t				pid;
	pid_t				tgid;

	/* Canary value for the -fstack-protector GCC feature: */
	unsigned long			stack_canary;
	 * Pointers to the (original) parent process, youngest child, younger sibling,
	 * older sibling, respectively.  (p->father can be replaced with
	 * p->real_parent->pid)

	/* Real parent process: */
	struct task_struct __rcu	*real_parent;

	/* Recipient of SIGCHLD, wait4() reports: */
	struct task_struct __rcu	*parent;

	 * Children/sibling form the list of natural children:
	struct list_head		children;
	struct list_head		sibling;
	struct task_struct		*group_leader;

	 * 'ptraced' is the list of tasks this task is using ptrace() on.
	 * This includes both natural children and PTRACE_ATTACH targets.
	 * 'ptrace_entry' is this task's link on the p->parent->ptraced list.
	struct list_head		ptraced;
	struct list_head		ptrace_entry;

	/* PID/PID hash table linkage. */
	struct pid_link			pids[PIDTYPE_MAX];
	struct list_head		thread_group;
	struct list_head		thread_node;

	struct completion		*vfork_done;

	int __user			*set_child_tid;

	int __user			*clear_child_tid;

	u64				utime;
	u64				stime;
	u64				utimescaled;
	u64				stimescaled;
	u64				gtime;
	struct prev_cputime		prev_cputime;
	struct vtime			vtime;

	atomic_t			tick_dep_mask;
	/* Context switch counts: */
	unsigned long			nvcsw;
	unsigned long			nivcsw;

	/* Monotonic time in nsecs: */
	u64				start_time;

	/* Boot based time in nsecs: */
	u64				real_start_time;

	/* MM fault and swap info: this can arguably be seen as either mm-specific or thread-specific: */
	unsigned long			min_flt;
	unsigned long			maj_flt;

	struct task_cputime		cputime_expires;
	struct list_head		cpu_timers[3];

	/* Process credentials: */

	/* Tracer's credentials at attach: */
	const struct cred __rcu		*ptracer_cred;

	/* Objective and real subjective task credentials (COW): */
	const struct cred __rcu		*real_cred;

	/* Effective (overridable) subjective task credentials (COW): */
	const struct cred __rcu		*cred;

	 * executable name, excluding path.
	 * - normally initialized setup_new_exec()
	 * - access it with [gs]et_task_comm()
	 * - lock it with task_lock()
	char				comm[TASK_COMM_LEN];

	struct nameidata		*nameidata;

	struct sysv_sem			sysvsem;
	struct sysv_shm			sysvshm;
	unsigned long			last_switch_count;
	/* Filesystem information: */
	struct fs_struct		*fs;

	/* Open file information: */
	struct files_struct		*files;

	/* Namespaces: */
	struct nsproxy			*nsproxy;

	/* Signal handlers: */
	struct signal_struct		*signal;
	struct sighand_struct		*sighand;
	sigset_t			blocked;
	sigset_t			real_blocked;
	/* Restored if set_restore_sigmask() was used: */
	sigset_t			saved_sigmask;
	struct sigpending		pending;
	unsigned long			sas_ss_sp;
	size_t				sas_ss_size;
	unsigned int			sas_ss_flags;

	struct callback_head		*task_works;

	struct audit_context		*audit_context;
	kuid_t				loginuid;
	unsigned int			sessionid;
	struct seccomp			seccomp;

	/* Thread group tracking: */
	u32				parent_exec_id;
	u32				self_exec_id;

	/* Protection against (de-)allocation: mm, files, fs, tty, keyrings, mems_allowed, mempolicy: */
	spinlock_t			alloc_lock;

	/* Protection of the PI data structures: */
	raw_spinlock_t			pi_lock;

	struct wake_q_node		wake_q;

	/* PI waiters blocked on a rt_mutex held by this task: */
	struct rb_root_cached		pi_waiters;
	/* Updated under owner's pi_lock and rq lock */
	struct task_struct		*pi_top_task;
	/* Deadlock detection and priority inheritance handling: */
	struct rt_mutex_waiter		*pi_blocked_on;

	/* Mutex deadlock detection: */
	struct mutex_waiter		*blocked_on;

	unsigned int			irq_events;
	unsigned long			hardirq_enable_ip;
	unsigned long			hardirq_disable_ip;
	unsigned int			hardirq_enable_event;
	unsigned int			hardirq_disable_event;
	int				hardirqs_enabled;
	int				hardirq_context;
	unsigned long			softirq_disable_ip;
	unsigned long			softirq_enable_ip;
	unsigned int			softirq_disable_event;
	unsigned int			softirq_enable_event;
	int				softirqs_enabled;
	int				softirq_context;

# define MAX_LOCK_DEPTH			48UL
	u64				curr_chain_key;
	int				lockdep_depth;
	unsigned int			lockdep_recursion;
	struct held_lock		held_locks[MAX_LOCK_DEPTH];

	struct hist_lock *xhlocks; /* Crossrelease history locks */
	unsigned int xhlock_idx;
	/* For restoring at history boundaries */
	unsigned int xhlock_idx_hist[XHLOCK_CTX_NR];
	unsigned int hist_id;
	/* For overwrite check at each context exit */
	unsigned int hist_id_save[XHLOCK_CTX_NR];

	unsigned int			in_ubsan;

	/* Journalling filesystem info: */
	void				*journal_info;

	/* Stacked block device info: */
	struct bio_list			*bio_list;

	/* Stack plugging: */
	struct blk_plug			*plug;

	/* VM state: */
	struct reclaim_state		*reclaim_state;

	struct backing_dev_info		*backing_dev_info;

	struct io_context		*io_context;

	/* Ptrace state: */
	unsigned long			ptrace_message;
	siginfo_t			*last_siginfo;

	struct task_io_accounting	ioac;
	/* Accumulated RSS usage: */
	u64				acct_rss_mem1;
	/* Accumulated virtual memory usage: */
	u64				acct_vm_mem1;
	/* stime + utime since last update: */
	u64				acct_timexpd;
	/* Protected by ->alloc_lock: */
	nodemask_t			mems_allowed;
	/* Seqence number to catch updates: */
	seqcount_t			mems_allowed_seq;
	int				cpuset_mem_spread_rotor;
	int				cpuset_slab_spread_rotor;
	/* Control Group info protected by css_set_lock: */
	struct css_set __rcu		*cgroups;
	/* cg_list protected by css_set_lock and tsk->alloc_lock: */
	struct list_head		cg_list;
	u32				closid;
	u32				rmid;
	struct robust_list_head __user	*robust_list;
	struct compat_robust_list_head __user *compat_robust_list;
	struct list_head		pi_state_list;
	struct futex_pi_state		*pi_state_cache;
	struct perf_event_context	*perf_event_ctxp[perf_nr_task_contexts];
	struct mutex			perf_event_mutex;
	struct list_head		perf_event_list;
	unsigned long			preempt_disable_ip;
	/* Protected by alloc_lock: */
	struct mempolicy		*mempolicy;
	short				il_prev;
	short				pref_node_fork;
	int				numa_scan_seq;
	unsigned int			numa_scan_period;
	unsigned int			numa_scan_period_max;
	int				numa_preferred_nid;
	unsigned long			numa_migrate_retry;
	/* Migration stamp: */
	u64				node_stamp;
	u64				last_task_numa_placement;
	u64				last_sum_exec_runtime;
	struct callback_head		numa_work;

	struct list_head		numa_entry;
	struct numa_group		*numa_group;

	 * numa_faults is an array split into four regions:
	 * faults_memory, faults_cpu, faults_memory_buffer, faults_cpu_buffer
	 * in this precise order.
	 * faults_memory: Exponential decaying average of faults on a per-node
	 * basis. Scheduling placement decisions are made based on these
	 * counts. The values remain static for the duration of a PTE scan.
	 * faults_cpu: Track the nodes the process was running on when a NUMA
	 * hinting fault was incurred.
	 * faults_memory_buffer and faults_cpu_buffer: Record faults per node
	 * during the current scan window. When the scan completes, the counts
	 * in faults_memory and faults_cpu decay and these values are copied.
	unsigned long			*numa_faults;
	unsigned long			total_numa_faults;

	 * numa_faults_locality tracks if faults recorded during the last
	 * scan window were remote/local or failed to migrate. The task scan
	 * period is adapted based on the locality of the faults with different
	 * weights depending on whether they were shared or private faults
	unsigned long			numa_faults_locality[3];

	unsigned long			numa_pages_migrated;

	struct tlbflush_unmap_batch	tlb_ubc;

	struct rcu_head			rcu;

	/* Cache last used pipe for splice(): */
	struct pipe_inode_info		*splice_pipe;

	struct page_frag		task_frag;

	struct task_delay_info		*delays;

	int				make_it_fail;
	unsigned int			fail_nth;
	 * When (nr_dirtied >= nr_dirtied_pause), it's time to call
	 * balance_dirty_pages() for a dirty throttling pause:
	int				nr_dirtied;
	int				nr_dirtied_pause;
	/* Start of a write-and-pause period: */
	unsigned long			dirty_paused_when;

	int				latency_record_count;
	struct latency_record		latency_record[LT_SAVECOUNT];
	 * Time slack values; these are used to round up poll() and
	 * select() etc timeout values. These are in nanoseconds.
	u64				timer_slack_ns;
	u64				default_timer_slack_ns;

	unsigned int			kasan_depth;

	/* Index of current stored address in ret_stack: */
	int				curr_ret_stack;

	/* Stack of return addresses for return function tracing: */
	struct ftrace_ret_stack		*ret_stack;

	/* Timestamp for last schedule: */
	unsigned long long		ftrace_timestamp;

	 * Number of functions that haven't been traced
	 * because of depth overrun:
	atomic_t			trace_overrun;

	/* Pause tracing: */
	atomic_t			tracing_graph_pause;

	/* State flags for use by tracers: */
	unsigned long			trace;

	/* Bitmask and counter of trace recursion: */
	unsigned long			trace_recursion;
#endif /* CONFIG_TRACING */

	/* Coverage collection mode enabled for this task (0 if disabled): */
	enum kcov_mode			kcov_mode;

	/* Size of the kcov_area: */
	unsigned int			kcov_size;

	/* Buffer for coverage collection: */
	void				*kcov_area;

	/* KCOV descriptor wired with this task or NULL: */
	struct kcov			*kcov;

	struct mem_cgroup		*memcg_in_oom;
	gfp_t				memcg_oom_gfp_mask;
	int				memcg_oom_order;

	/* Number of pages to reclaim on returning to userland: */
	unsigned int			memcg_nr_pages_over_high;

	struct uprobe_task		*utask;
	unsigned int			sequential_io;
	unsigned int			sequential_io_avg;
	unsigned long			task_state_change;
	int				pagefault_disabled;
	struct task_struct		*oom_reaper_list;
	struct vm_struct		*stack_vm_area;
	/* A live task holds one reference: */
	atomic_t			stack_refcount;
	int patch_state;
	/* Used by LSM modules for access restriction: */
	void				*security;

	 * New fields for task_struct should be added above here, so that
	 * they are included in the randomized portion of task_struct.

	/* CPU-specific state of this task: */
	struct thread_struct		thread;

	 * WARNING: on x86, 'thread_struct' contains a variable-sized
	 * structure.  It *MUST* be at the end of 'task_struct'.
	 * Do not put anything below here!
版权声明: https://blog.csdn.net/qq_35830314/article/details/79980557


C语言中的结构体——>C语言的实体1.结构体概念 2. 结构体声明 3. 结构体定义 5. 结构体变量成员的引用 6. 结构体变量的赋值 7. 结构体变量的初始化 8. 结构体...
  • qq_29924041
  • qq_29924041
  • 2017-01-14 22:58:51
  • 1141

Linux C 结构体

gcc的编译过程 预处理阶段,不会进行运算操作,只进行替换;在编译时,才进行运算; 若想得到预想结果,加()即可; 宏函数: 返回值类型 参数列表; 不考虑c的语法,不用管什么类型,都当做字...
  • frankpi
  • frankpi
  • 2015-10-19 23:06:02
  • 1299


最近因项目需要,用到结构体来传参数 下面整理一下,以备查阅 1,初始化(赋值)方式(注意,在定义结构体时是不允许赋值的) 第一种:这种比较常用,也比较清晰 struct TEST{ int a...
  • baidu_36649389
  • baidu_36649389
  • 2017-03-18 16:53:16
  • 2038


测试环境: vs2008 1. 前言 C语言是一个比较底层的语言,似乎没有c++,java高级语言中对成员变量的保护,例如加上private修饰。但其实C语言也可以通过结构体的声明达到类型的效果。...
  • kao2406
  • kao2406
  • 2017-06-19 22:33:46
  • 781


  • baidu_33232390
  • baidu_33232390
  • 2017-02-16 11:17:07
  • 2949


定义结构体中的偏移量 结构体中的偏移量是一个成员的实际地址和结构体首地址之间的距离。 结构体大小计算 结构体大小 会涉及到字节对齐(目的是 让计算机快速读写 以空间换取时间)。即,最后一个成...
  • u012807459
  • u012807459
  • 2015-09-18 13:08:30
  • 4250


1;关于c语言结构体的引入; 在前面已经介绍了整形(int,long,….),浮点型(flaot,double),字符型(char),还介绍了数组(存储一组具有相同类型的数据),字符串。但是在实际问...
  • zw1996
  • zw1996
  • 2016-12-24 14:47:25
  • 9680


c语言中结构体以及结构体标签很容易产生误解 申明一个结构体标签的方式是: struct Stack { int *Array; int Top; }; 以后要用到这个结构体标签,前面都要注明是...
  • way88liu
  • way88liu
  • 2014-12-20 16:20:06
  • 857


版权声明:本文为博主原创文章,未经博主允许不得转载。 结构体是一种数据结构,类似 C++的类。 结构体中 可能包含 很多种变量: (整型,浮点型,结构体,指针); 结构体在定...
  • wei0301
  • wei0301
  • 2016-11-17 18:18:59
  • 643


转载请标明出处: http://blog.csdn.net/u011974987/article/details/52305364 本文出自:【XuHao的博客】 结构体在C语言中,可以使用结...
  • u011974987
  • u011974987
  • 2016-08-24 23:57:42
  • 6504
您举报文章:C 结构体