小编Kal*_*nga的帖子

需要解释在什么情况下我们应该在 C 中将 & 与 printf 一起使用

据我所知,在 c 中使用时printf()我们不使用 &.对吗?但是在我的程序中,如果我不在显示功能中使用它,它会给我一个错误。有人可以解释一下吗?谢谢

#include<stdio.h>
#define max 100
void enqueue();
char dequeue(void);
int front=-1,rear=-1,option;
char name[max][max],val;
void display(void);


void enqueue() {

    printf("Enter the name of the paitent : ");
    if(rear==max-1)
        printf("Line is full");
    else if (front==-1 && rear==-1)
        front=rear=0;
    else
        rear++;
    scanf("%s",&name[rear][rear]);

}

char dequeue(void) {
    char val;
    if(front==-1 || front >rear )
        printf("Line is empty");
    else
    {
        val=name[front];
        front++;
        if(front>rear)
            front=rear=-1;
        return val;
    }
}
void display(void) {
    int i;
    if(front==-1|| front >rear)
        printf("The queue is empty"); …
Run Code Online (Sandbox Code Playgroud)

c printing printf output

-3
推荐指数
1
解决办法
125
查看次数

标签 统计

c ×1

output ×1

printf ×1

printing ×1