Is that a C or C++ code, I have tried to run it and when I saw the libraries and the cin's I thought there is something wrong in posting this code.
Type: Posts; User: Terrorist
Is that a C or C++ code, I have tried to run it and when I saw the libraries and the cin's I thought there is something wrong in posting this code.
1-even and odd are uninitialized junk integers when the function is called.
2- why are you using '==' here ?
What's the difference if I may ask ?
Thanks root4, that's pretty neat, at least as optimized as possible.
P.S. The lines with bold and red fonts are the new additions:
Function "compare" declaration,
Function call.
and function definition.
With these warnings in compilation:
68 C:\Dev-Cpp\Projects\bracket_final_testing_with_comp.c [Warning] passing arg 1 of `compare' from incompatible pointer type
68...
Here it is:
#include <stdio.h>
#define B_OPEN '<'
#define B_CLOSE '>'
#define BRACKET_MAX 10
#define B_CHAR_MAX 7
char bracket[B_CHAR_MAX]={0}; //THE OPENING BRACKETS ARRAY
Yes I did. I am trying to implement that code you gave me to adapt in here, but it doesn't seem to work. I have defined the function compare using the code you posted, called that function after...
That's the problem matsp, knowing the end of the tag. Since I am using the '>' as a marker of ending the tag in the push function AND it indicates if there are errors such as: infiniate tags, large...
So in other words, each row of those 2-D arrays should end with null char ? which is not possible, is it ?
Actually it's my friends' assignment, but since long time no C for me, I wanted to do it myself, I have done most of the work here, but still the comparison part should be done.
How does the...
Hi,
What if it's not allowed to use string.h ? for the strcmp part ? is there any other way to do it ?
So what do you think I need to do in here ? I am working on two different codes at the same time, almost lost in this one.
Hi,
here is the final code, but the 'compare' function doesn't seem to work. Can someone please help me in this.
#include <stdio.h>
#define B_OPEN '<'
#define B_CLOSE '>'
#define...
Hi,
I have solved the problem of separating the closing tags from the openeing tags and now I have got something like this:
<html><body>This is HTML</body></html>
You have written 4...
Thank You Very much, actually that was GREAT hint from you, I have solved the problem....Finally, Just added increment to the char C (c=getchar();) before those nested IF's and now it works :D:D
Hi,
Attached the C file, and for where is the problem's cause, I am not really sure, but maybe:
this bit:
while((c=getchar())!=EOF && c!='\n'){
if(c==B_OPEN){
if...
Hello folks,
I have started to write this simple program that reads from keyboard, stores the on tags (aka <html>) into a 2-D array, and stores the off-tags (aka. </html>) into another. then print...