연결리스트로 구현한 큐 실행시 오류

tjddms5936의 이미지

#include <stdio.h>
#include <stdlib.h>
 
typedef int element; // 요소의 타입은 int 
typedef struct ATM1{ // ATM1 큐의 노드의 타입 : int형 element가 2개(고객정보), link 한개  
	element number;
	element service_time;
	struct ATM1 *link;
}ATM1;
 
typedef struct{
	ATM1 *front, *rear; 
	//int count;
}LinkedATM1;
 
 
int is_empty1(LinkedATM1*q)
{
	return 0;
}
 
// ATM1 삽입 함수 
void enqueue1(LinkedATM1*q, element number, element service_time)
{
	ATM1*temp = (ATM1*)malloc(sizeof(ATM1));
	temp->number = number;
	temp->service_time = service_time;
	temp->link = NULL; 
	if(is_empty1(&q)){ // 큐가 비어있다면   <----- 이부분에서 오류가 뜹니다. 
		q->front = temp;
		q->rear = temp;
	}
	else{ // 큐가 공백이 아니라면
		q->rear->link = temp; 
		q->rear = temp;  
		//LinkedATM1->count++;
	}
} 
 
// ATM1 삭제 함수 
element dequeue1(LinkedATM1*q)
{
	ATM1*temp = q->front;
	element number;
	element service_time;
	if(is_empty1(&q)){
		exit(1);
	}	
	else{
		number = temp->number;
		service_time = temp->service_time;
		q->front = q->front->link;
		if(q->front==NULL){
			q->rear = NULL;
		}
		free(temp); // temp동적메모리 헤제 
		//LinkedATM1->count--;
		return number, service_time; // number, service_time 반환  
	}
} 
 
int main(void)
{
	LinkedATM1 q;
	enqueue1(&q, 0, 3);
	printf("%d", enqueue(&q));
	return 0;
}

위에 오류떳다는 부분에서 [Warning] passing argument 1 of 'is_empty1' from incompatible pointer type 라고 뜹니다. 해결방법이 없을까요?

참고로 풀고자 하는 문제는 사진첨부하겠습니다. 현재 ATM을 구현하기 위한 작업중입니다.

File attachments: 
첨부파일 크기
Image icon 자료구조 과제.png210.11 KB
라스코니의 이미지

int is_empty1(LinkedATM1*q)와 void enqueue1(LinkedATM1*q, element number, element service_time)의 'q' 타입이 같아요.

그냥 is_empty1(q) 로 호출하시면 됩니다.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.