probably due to a buffer overrun. You only allow the storage of 11 characters for each town name, but Bournemouth requries 12. 11 plus a null character.
Since there is no null stored at the end of...
Type: Posts; User: spydoor
probably due to a buffer overrun. You only allow the storage of 11 characters for each town name, but Bournemouth requries 12. 11 plus a null character.
Since there is no null stored at the end of...
You probably just need another getchar() at the end to "keep the window open"
Since you have a leftover new line from your second scanf now
tot is a double so you should be using %lf in your scanf
scanf("%lf",&tot);
there is a newline character left over in the input buffer after entering a total, so tea is likely getting set to...
Looks like you need to allocate some space for *myregex.
Also, need to escape your backslashes in the expression
"^ *[-+]?([0-9]+(\\.[0-9]*)?|\\.[0-9]+)([eE][-+]?[0-9]+)? *$",
You set y to the strlen of key before key is initialized.
You should do this after gets. (you should also use fgets instead of gets)
You use i uninitialized.
do {
printf("\n Number of tries left : %d", guess);
printf("\n %s", letters_guessed);
printf("\n Word to guess : ");
for(i = 0;...
The return value of scanf is never going to equal '.'
It will equal the number of successfully matched and assigned input items.
The first letter you read in is not being used in your checksum...
Where?
The original poster's usage of sscanf is correct. The first paramter should be char *
As already pointed out the problem is with the format specifier for long and short
%ld and %hd may...
while (fscanf(fin, "%25[^ ]. %25[^ ].%c %c\n", Nlen, STU->LName, STU->FName, &STU->Sex,&STU->Grade) != EOF){
Nlen, should not be there at all. You are trying to store a value in '25'
You have...
The only place you ever try to write to the file is in view_stud.
It looks like you are trying to rewrite the file to itself. Why?
Having the same file open for reading and writing is not good.
...
Why do your cases ever return a trailing \
It looks like you always want \#
I would think your cases should be more like...
"\\8"
"\\333"
"\\555"
...
The first parameter to your ArraySort function should be an array not an integer.
Num is the name of your array.
for (i = 0; i < Max && Num[i] != 0; i++)
Num[i] will always be uninitialized....
void Calculate( loan *details )
{
void Amortization ( loan *details );
Try moving the Amortization prototype outside of your Calculate function. (near the other prototypes)
change double...
Maybe if you print the string after fgets you'll understand what is going on.
But to try to explain:
the loop is entered
"Enter something :" is printed
You type a string and hit enter
16...
Actually strcmp doesn't necessarily return 1 or -1 but a number less than or greater than 0 if they differ
The first retuns a negative number because 'H' is less than 'W'
The second returns 0...
Well you're not passing anything, so as long as your array is being filled properly it should be available to all of your functions
any function that does not return a value should be void
...
Nope. In one place you are delcaring a char* in the other you are using the variable that happens to be a char*
the return type of your function is a char*
int a;
char* formula;
a is an int...
Since you haven't learned functions yet ...
int is_prime
for all numbers you want to test {
is_prime = 1 //start by assuming prime
for (i=2; i < number ; i++) { //or a more efficient...
getage() doesn't print the age it just returns it.
either set it to a variable and do something with it, or just print it
cout << anakin.getage() << endl;
I also suggest you don't use system, but of course it is possible.
string name;
string cmd;
cout << "please enter a name... " << endl;
cin >> name;
cmd = "mkdir " +...
It's very difficult to follow what you are trying to do
by the time you get to here
slist[i].stocknumber = atoi(tempstr);
i will always equal numitems. You always run to the end of the for...
You need to pass roomnum as a pointer if you want findfree to change the value of it.
findfree(&roomnum);
int findfree(int *room)
{
...
*room = i;
...
It seems like a safe way to do it would be to open a new file.
Write the new line to the new file.
Write the contents of the current file to the new file.
Then replace the current with the new.
...
esbo can you please give an example of a c function that returns a "string" and not a char *
where is main :confused:
besides that your first line actually has 11 four character words not 10