C的误差:之前的预期前pression'||'象征 [英] C error: expected expression before '||' token
本文介绍了C的误差:之前的预期前pression'||'象征的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面是我的code的功能合并:
Here is my code for the function merge:
#include <stdio.h>
#include "merge.h"
void merge(
char a1[], int n1,
char a2[], int n2,
char output[])
{
int i = 0;
int j = 0;
int z = 0;
while (i < n1) || (j < n2) // This is where the error happends
{
if (i < n1) && (j < n2)
if (a1[i] <= a2[j])
output[z++] = a1[i++];
else
output[z++] = a2[j++];
else if (j == n2)
while (i < n1)
output[z++] = a1[i++];
else if (i == n1)
while (j < n2)
output[z++] = a2[j++];
}
}
您能告诉我为什么code的这个错误?我已经看了所有与此相同的错误问题,但它似乎像有这个错误没有统一的答案...
非常感谢!
Could you tell me why the code has this error? I have looked at all the questions with this same error but it seems like there was no universal answer for this error... Thanks a lot!
推荐答案
Englobe括号之间的充分条件:
Englobe the full condition between brackets:
while ((i < 3) || (j < 3))
您也可以使用:
while (i < 3 || j < 3)
和与认真:
if (i < n1) && (j < n2)
其可以是:
if (i < n1 && j < n2)
这篇关于C的误差:之前的预期前pression'||'象征的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文