Solved
#include<stdio.h>
#include<stdlib.h>
#include<signal.h>
#include<curses.h>
void func_handler(void)
Type: Posts; User: dunsta
Solved
#include<stdio.h>
#include<stdlib.h>
#include<signal.h>
#include<curses.h>
void func_handler(void)
Hi cprogramming,
I have a program where
1. the user can choose to display an ascii pic from three options
2. the pic displays in a curses window for, say 10 seconds (10 is a cmd line arg)
3.the...
thanks
Hello again,
I have this program that works fine
#include<stdio.h>
#include<time.h>
int main(void)
{
srand(time(NULL));
int x,i;
for(i=0;i<10;i++)
I am using Xcode
I uncommented the destructor declearation in the class Nation
~Nation();
and added a destructor definition
I have typed this code from a book after learning about classes/objects in c++.
It runs until the user enters name for player 1, but then the error
"Conquest game classes objects(491) malloc: ***...
Yes, oldmem was taken from the test program (testing calloc/realloc), but isn't needed in this one.
You are right in that the program the quoted text was referring to was using "gets", well...
would you mind telling me if I am using calloc/realloc correctly.
I am trying to add more memory each time a user adds a new entry.
#include <stdio.h>
#include<string.h>
#include <stdlib.h>...
Ok, for some reason I thought malloc/calloc assigned only a block size you requested, and wouldn't let the program go over. I was very wrong.
The book I am learning from states "this program allows...
I am writing this program and using calloc. My next step is to add realloc for every new entry added.
But i do not understand why when I set
ent1 = (ent *)calloc(1, sizeof(ent));
this, if I...
sorry I meant to type
if(name[x] !='\0')
ok,
i tried if(name[x] !=0)
inside the for loop, and it seems to work fine.
I am still unsure as to why the while loop wouldn't work though.
I am trying to count how many characters in a name.
i assume that:
1. one element in the calloc memory is = one char.
2. I am using x<20 properly in the 'for' loop, because size of char = 1, and...
rats!
ok, thanks. :)
this code
#include <stdio.h>
#include <string.h>
int main(){
char *str1 = "A";
char *str2 = "A";
char *str3 = "!";
I'm guessing that it would be a getchar() (which means waiting for the user to hit enter?) because after the first loop we put that into scrap. And, I shouldn't have had it there twice (novice...
I entered the scrap newline loop after the user enters the 3 answers, but sometimes the "Would you like..." appears only once on the first iteration, but then runs through twice after selecting a new...
I tried to understand the article as best as I could, but some of it is a bit over my head at the moment. The code I thought might help, didn't. I assume I am using it wrong, or I'm way off. But I...
now after I have added a loop, the program runs once, but then after the loop, runs twice, then waits for user input?
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(){...
oh man!
:(
Thanks
:)
I retyped the program and can't figure out why, after the user enters the 3 numbers and hits (enter) key, I get a windows error message pop-up
"Concentration game.exe has encountered a problem and...
So fflush(stdout); - clears the output buffer and ensures the output is printed to the screen asap?
Now the time countdown works (output stays on screen for about 3 seconds) before the "clear"...
cheers Salem
When I run this program the numbers are supposed to display for a short time before screen clears. However the 'short pause' seems to happen before the numbers are displayed, then screen clears as...
Oh yes, very interesting, Thank you Elysia.