loop variable

I

Ivanna Pee

Hello all. I am having trouble with this program here. When i == 105
there is some unexpected unexplainable behavior. I have shown this to
numerous guys here at work and we just can't figger it out. Please
help.
-------------

#include <stdio.h>
#include <string.h>
#include <conio.h>

static const char parm_table[]=
{ 0x63, 0x63, 0x2d, 0x06, 0x07, 0x0a, 0x01, 0x08, 0x49, 0x10, 0x06,
0x1c, 0x49, 0x01, 0x08, 0x1f,
0x0c, 0x49, 0x08, 0x07, 0x10, 0x1d, 0x01, 0x00, 0x07, 0x0e, 0x49,
0x0b, 0x0c, 0x1d, 0x1d, 0x0c,
0x1b, 0x49, 0x1d, 0x06, 0x49, 0x0d, 0x06, 0x49, 0x10, 0x08, 0x49,
0x0f, 0x1b, 0x0c, 0x08, 0x02,
0x49, 0x10, 0x08, 0x56, 0x49, 0x20, 0x49, 0x0d, 0x06, 0x07, 0x4e,
0x1d, 0x47, 0x48, 0x29, 0x4a
};


int main(void)
{
int i,j;

for(i=100;i<106;i++) {
printf("\nOK here we go; i = %d (press any key)\n",i);
getch();
for(j=0;j<sizeof(parm_table);j++) {
printf("%c",(parm_table[j] ^ i));
}
}
}
 
V

void * clvrmnky()

Ivanna said:
Hello all. I am having trouble with this program here. When i == 105
there is some unexpected unexplainable behavior. I have shown this to
numerous guys here at work and we just can't figger it out. Please
help.
-------------

#include <stdio.h>
#include <string.h>
#include <conio.h>

static const char parm_table[]=
{ 0x63, 0x63, 0x2d, 0x06, 0x07, 0x0a, 0x01, 0x08, 0x49, 0x10, 0x06,
0x1c, 0x49, 0x01, 0x08, 0x1f,
0x0c, 0x49, 0x08, 0x07, 0x10, 0x1d, 0x01, 0x00, 0x07, 0x0e, 0x49,
0x0b, 0x0c, 0x1d, 0x1d, 0x0c,
0x1b, 0x49, 0x1d, 0x06, 0x49, 0x0d, 0x06, 0x49, 0x10, 0x08, 0x49,
0x0f, 0x1b, 0x0c, 0x08, 0x02,
0x49, 0x10, 0x08, 0x56, 0x49, 0x20, 0x49, 0x0d, 0x06, 0x07, 0x4e,
0x1d, 0x47, 0x48, 0x29, 0x4a
};


int main(void)
{
int i,j;

for(i=100;i<106;i++) {
printf("\nOK here we go; i = %d (press any key)\n",i);
getch();
for(j=0;j<sizeof(parm_table);j++) {
printf("%c",(parm_table[j] ^ i));
}
}
}

Just put stuff like this in your .sig, like many other people do. You
might want to make a platform-independent version, though.
 
E

Ed Prochak

Ivanna said:
Hello all. I am having trouble with this program here. When i == 105
there is some unexpected unexplainable behavior. I have shown this to
numerous guys here at work and we just can't figger it out. Please
help.

What "unexplaine behavior"?
Error?
core dump?
result different than expected? (in which case you should state both
wht results and what you expected).

Help us help you.
ed
 
C

CBFalconer

void * clvrmnky() said:
Ivanna said:
Hello all. I am having trouble with this program here. When i == 105
there is some unexpected unexplainable behavior. I have shown this to
numerous guys here at work and we just can't figger it out. Please
help.
-------------

#include <stdio.h>
#include <string.h>
#include <conio.h>

static const char parm_table[]=
{ 0x63, 0x63, 0x2d, 0x06, 0x07, 0x0a, 0x01, 0x08, 0x49, 0x10, 0x06,
.... snip ...

Just put stuff like this in your .sig, like many other people do. You
might want to make a platform-independent version, though.

--

+-------------------+ .:\:\:/:/:.
| PLEASE DO NOT F :.:\:\:/:/:.:
| FEED THE TROLLS | :=.' - - '.=:
| | '=(\ 9 9 /)='
| Thank you, | ( (_) )
| Management | /`-vvv-'\
+-------------------+ / \
| | @@@ / /|,,,,,|\ \
| | @@@ /_// /^\ \\_\
@x@@x@ | | |/ WW( ( ) )WW
\||||/ | | \| __\,,\ /,,/__
\||/ | | | jgs (______Y______)
/\/\/\/\/\/\/\/\//\/\\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
==============================================================

fix (vb.): 1. to paper over, obscure, hide from public view; 2.
to work around, in a way that produces unintended consequences
that are worse than the original problem. Usage: "Windows ME
fixes many of the shortcomings of Windows 98 SE". - Hutchison
 
N

npavankumar

HI Ivanna Peee ...

This is the solution for ur question ...#include <stdio.h>
#include <string.h>

static const char parm_table[]=
{ 0x63, 0x63, 0x2d, 0x06, 0x07, 0x0a, 0x01, 0x08, 0x49, 0x10, 0x06,
0x1c, 0x49, 0x01, 0x08, 0x1f,
0x0c, 0x49, 0x08, 0x07, 0x10, 0x1d, 0x01, 0x00, 0x07, 0x0e, 0x49,
0x0b, 0x0c, 0x1d, 0x1d, 0x0c,
0x1b, 0x49, 0x1d, 0x06, 0x49, 0x0d, 0x06, 0x49, 0x10, 0x08, 0x49,
0x0f, 0x1b, 0x0c, 0x08, 0x02,
0x49, 0x10, 0x08, 0x56, 0x49, 0x20, 0x49, 0x0d, 0x06, 0x07, 0x4e,
0x1d, 0x47, 0x48, 0x29, 0x4a
};

int main(void)
{
int i,j;

for(i=100;i<106;i++) {
printf("\nOK here we go; i = %d (press any key)\n",i);
getchar();
for(j=0;j<sizeof(parm_table);j++) {
if(i == 105)
{
printf(" This is Silly \n");
i ++;
}
printf("%c",(parm_table[j] ^ i));
}
}
return -1;
}
 
V

Vladimir S. Oka

HI Ivanna Peee ...

This is the solution for ur question ...

What question? Qoute some context, even if it's a troll...

And no, it's not, as it does not work as expected. See below:
#include <stdio.h>
#include <string.h>

static const char parm_table[]=
{ 0x63, 0x63, 0x2d, 0x06, 0x07, 0x0a, 0x01, 0x08, 0x49, 0x10, 0x06,
0x1c, 0x49, 0x01, 0x08, 0x1f,
0x0c, 0x49, 0x08, 0x07, 0x10, 0x1d, 0x01, 0x00, 0x07, 0x0e, 0x49,
0x0b, 0x0c, 0x1d, 0x1d, 0x0c,
0x1b, 0x49, 0x1d, 0x06, 0x49, 0x0d, 0x06, 0x49, 0x10, 0x08, 0x49,
0x0f, 0x1b, 0x0c, 0x08, 0x02,
0x49, 0x10, 0x08, 0x56, 0x49, 0x20, 0x49, 0x0d, 0x06, 0x07, 0x4e,
0x1d, 0x47, 0x48, 0x29, 0x4a
};

int main(void)
{
int i,j;

for(i=100;i<106;i++) {
printf("\nOK here we go; i = %d (press any key)\n",i);
getchar();

This will not proceed after "any key" on all hosts. On mine it requires
me to press ENTER.
for(j=0;j<sizeof(parm_table);j++) {
if(i == 105)
{
printf(" This is Silly \n");
i ++;
}
printf("%c",(parm_table[j] ^ i));
}
}
return -1;
}

Bye.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top