minishell
vect_at.c
Go to the documentation of this file.
1 /* ************************************************************************** */
2 /* */
3 /* ::: :::::::: */
4 /* vect_at.c :+: :+: :+: */
5 /* +:+ +:+ +:+ */
6 /* By: kfujita <kfujita@student.42tokyo.jp> +#+ +:+ +#+ */
7 /* +#+#+#+#+#+ +#+ */
8 /* Created: 2023/01/28 00:23:26 by kfujita #+# #+# */
9 /* Updated: 2023/01/28 01:23:28 by kfujita ### ########.fr */
10 /* */
11 /* ************************************************************************** */
12 
13 #include "ft_vect.h"
14 
15 void *vect_at(const t_vect *vect, size_t index)
16 {
17  unsigned char *p;
18 
19  if (vect->len <= index)
20  return (NULL);
21  p = vect->p;
22  return (p + (vect->elemsize * index));
23 }
Definition: ft_vect.h:24
size_t elemsize
Definition: ft_vect.h:27
void * p
Definition: ft_vect.h:28
size_t len
Definition: ft_vect.h:26
void * vect_at(const t_vect *vect, size_t index)
Definition: vect_at.c:15