Hi,
Why not a circular linked list of 10 nodes (entry 9 next is a pointer to entry 0) and a pointer (lastentry) to the last entry?
Then input the next entry to lastentry->next->whatever and...
Type: Posts; User: Pappy1942
Hi,
Why not a circular linked list of 10 nodes (entry 9 next is a pointer to entry 0) and a pointer (lastentry) to the last entry?
Then input the next entry to lastentry->next->whatever and...
Hi,
Just do str[100] = '\0'; ///?????
This is not a good idea unless you KNOW that at least 101 char's have
been allocated for the string.
You might be putting the '\0' in the middle of...
Hi,
I don't know if this will help but to print 5 digits, even with ints less than 10000, use :
int num = 0; // can be any number up to 99999
printf("\nThe number is %05d",num);
Why not ??
union intchar
{
short int i;
char cs[2];
};
Hi,
Looking at your string
/* Blah2 */ text /* /* Blah */ */
Shouldn't the output be
text */
Hi,
Try the code snippet below in a short program.
unsigned char a;
char b;
a = 0xff;
b = 0xff;
Hi,
Do you mean something like this?
union aryint
{
char chrs[4];
int x;
};
Hi,
The program below searches for a single char in a string.
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <string.h>
int main()
Hi,
Below is a sample that puts the first four char's form one string into another string.
#include <stdio.h>
#include <conio.h>
int main()
{
char *mystr = "this is the input string";
...
Hi,
If I'm not mistaken, programs compiled with MSV++6 will not run on "Regular" DOS(ie. DOS 6.22).
If you want to write programs for DOS try one of the free compilers from Borland. I use Turbo...
Hi,
Do you mean a string std::string or an array of char's?
To clear an array of char's so that C sees an empty string just make the first element 0(zero).
char mystr[20] = "this is a test";...
Hi,
What you seem to be asking is a way to fing the prime factors of
a number.
First of all,not all numbers have 2 prime factors. Prime numbers have only themselves.(One is not considered a...
Hi,
One way is to print a dummy string with all spaces. Then fill the dummy string starting at the right end and printing it again.
You will have to use gotoxy(...) so the dummy string prints in...
Hi,
Look here.
http://www.cis.upenn.edu/~mcken/pet/portio/ReadMe.html
Pappy
Hi,
socket.h is not for windows.
Try winsock.h. Some of the def's are the same as socket.h.
Hope this helps.
Hi,
Below is a way around the scanf problem. Maybe not the best but it works in both of my 16bit compilers and the free Borland 5.5.
#include<stdio.h>
#include <conio.h>
int main()
{
...
Hi,
Be aware that different compilers have different values for RAND_MAX.
Thus the formula
x = rand() % 50000 + 1
may not give a vaule higher than 32,768.
Hi,
Nowadays many printers will not print in DOS. Before going any further look up your printer on the net to find out if it will print in DOS.
If not, easiest work around is to print to a file....
Hi,
Try this.
#include <conio.h>
#include <stdio.h>
int main()
{
char a;
while(!kbhit())
{
Hi,
In the good old days of DOS, controlling the printer port was easy. outp(port,byte) would send a byte to the port.
outp(0x378,byte) sends the byte to the printer port.
This may or may not...
Hi again,
Below is code that will give the "digits" base 256 of a base 10 number. Digits is in quotes because it really gives an int from 0 to 255. Since it woulb be difficult to come up with...
Hi,
Are you trying to convert 123 base(256) to a decimal number?
That is
1 times 256 raised to the 2nd power plus
2 times 256 rasied to the 1st power plus
3 times 256 rasied to the 0...
Hi,
Question 1.
No. When you allocate memory for foobar you get memory for a long int (count) and two pointers to NODE's. No data in that.
To start the list make head point to memory allocated...
Hi,
It seems that you have created a pointer to BankID rather than an instance of a BankID.
Try
BankID bankid1;
/*if you need a pointer then add */
BankID *bankidp;
Hi,
Link lists are used when you don't know how many nodes you are going to have.
Each time you need a new node you allocate memory ( malloc() etc.) for it. The pointer returned from the allocation...