473,395 Members | 1,456 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

loop variable

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));
}
}
}

Apr 6 '06 #1
5 1383
Ivanna Pee wrote:
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.
Apr 6 '06 #2

Ivanna Pee wrote:
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

Apr 6 '06 #3
"void * clvrmnky()" wrote:
Ivanna Pee wrote:
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
Apr 6 '06 #4
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;
}

Apr 7 '06 #5

np*********@gmail.com wrote:
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.

Apr 7 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: beliavsky | last post by:
In a Python 'for' loop, one can change the value of looping variable, so that for i in range(3): i = i*5 print i is legal code In Fortran 90 and 95, the analogous code
33
by: Arthur | last post by:
>>>a= >>> for p in a: print p 1 2 3 >>> p 3 My naive expectation was that p would be 'not defined' from outside
12
by: reynoldscraigr | last post by:
Hi All, hope someone can see what wrong here I have the following function function RemoveMenuFromHoldArray(menuName) { var i = 0; for (i=0;i<=MenusToHoldOpen.length-1;i++) { if...
7
by: Mahesh Kumar Reddy.R | last post by:
Hi Can any body resolve this.. In what cases one of the loop constructs better than other interms of speed , space and any other (redability). thanks mahesh
6
by: david | last post by:
I try to use "for" loop to retrieve and assign values in web form. The code is in the following. But it can not be compiled. What I want to do is: txtQ1.Text =...
29
by: garyusenet | last post by:
I'm trying to investigate the maximum size of different variable types. I'm using INT as my starting variable for exploration. I know that the maximum number that the int variable can take is:...
14
by: Michael Moreno | last post by:
Hello, Would you know what is best practice please between say: CODE 1: TimeSpan ts; for (i=0; i<1000; i++) {
4
by: =?Utf-8?B?VG9kZCBKYXNwZXJz?= | last post by:
Hey guys, Is there ANY way to accomplish this: (see below)? Basically, I want to have a loop (a < 3 is just for testing purposes, it will be an underermined amount). In this loop, I want to be...
5
by: sgurukrupagmailcom | last post by:
Hi, I haven't come accross an elegant solution to a design problem that I show below. Have a look at the piece of code here: class Exc { Exc () { System.out.println ("Haribol"); }
1
by: JavaJon | last post by:
Hello, I'm Jon. I've recently picked up Java after using a "gimmick" programming language called GML ( Game Maker Language ). I've read a lot of tutorials and even a Java for Dummies *.pdf book....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.