Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 |
Tags
- 프로그래머스
- 코딩테스트
- 모의 주식
- 빅데이터
- frontend
- C++
- Project
- 코스닥
- 이웃한 칸
- 자바독학
- 개발
- java
- 개인프로젝트
- Reflex
- backend
- 주가예측
- Python
- 백준
- SNS
- 프로그래밍
- 사물인터넷
- 개발자
- 코테
- 풀스택프레임워크
- 자바
- 코딩독학
- java정리
- 자바정리
- 프로그램
- 코딩
Archives
- Today
- Total
Creative Code
main.c(queue) 본문
※main.c파일
#include <stdio.h>
#include "queue.h"
int main(void)
{
push(100);
push(200);
printf("1st pop() : %d\n",pop());
push(300);
printf("2nd pop() : %d\n",pop());
printf("3rd pop() : %d\n",pop());
}
※queue.h파일
#ifndef QUEUE_H
#define QUEUE_H
void push(int data);
int pop(void);
#endif
※queue.c파일
static int queue[100];
static int rear;
static int front;
void push(int data)
{
queue[rear] = data;
++rear;
}
int pop(void)
{
int index = front;
++front;
return queue[index];
}
'C Programming' 카테고리의 다른 글
main.c(queue malloc) (0) | 2023.08.25 |
---|---|
main.c(queue 구조체) (0) | 2023.08.25 |
main.c(스택-메모리함수사용) (0) | 2023.08.25 |
main.c(스택을 malloc으로 크기할당) (0) | 2023.08.25 |
variantArray.c(malloc) (0) | 2023.08.25 |