Works fine for me.
int mapdist[10][10] = {
{0,4,5,6,7,8,9,8,7,6},
{2,0,4,5,6,7,8,9,8,7},
{1,2,0,4,5,6,7,8,9,8},
{2,3,4,0,6,7,8,9,8,7},
Type: Posts; User: jamie85
Works fine for me.
int mapdist[10][10] = {
{0,4,5,6,7,8,9,8,7,6},
{2,0,4,5,6,7,8,9,8,7},
{1,2,0,4,5,6,7,8,9,8},
{2,3,4,0,6,7,8,9,8,7},
You would think. However out lecturer hates strtok with a passion.
Why is the following syntax not legal?
struct additives {
char* milk[7]; = { "Skimmed", "Frothy", "half-skim", "Cream" };
};
You can use a pointer to step along each character in the string, and then compare what the pointer is pointing at with ' " '.
Works for me.
Except the fact that your loop will not terminate when it hits the end of your string.
Setup a char pointer to your string, and then use
isspace()
to determine whether you are pointing at white space or not.
Then either move the pointer along to the next element, or add the...
strip_newline() is declared as a void, however your using return.
Try declaring the function as an int, and see where you get from there.
/* if both strings have leading '.'s */
return strcmp( &((char *)name1)[1], &((char *)name2)[1]);
No need for copying.
And just use conditions similar to Salems to determine what you need...
You declare main as an int, but you dont return anything at the end of the function.
try this
float array[12];
Thanks salem very helpful of you
cheers Ancient Dragon nice tip.
int qsort_contents(const void* name1, const void* name2)
{
/* check the first file names first characted so we know if we need
I have the following code to add directory contents to a malloc'ed array of pointers to arrays.
However, after passing the 2d array to qsort, qsort returns nothing in the array.
array here =...
I was using fgets however i had this little piece of code
p = strchr(linebuf, '\n');
if (p)
*p = '\0';
#define MAXLINELEN 4096
char linebuf[MAXLINELEN];
FILE *history_stream;
if ( ( history_stream = fopen("history.txt", "a+") ) == NULL )
{
perror("Bash");
I am using fputs like so
strcat(linebuf, "\n");
fputs(linebuf, history_stream);
I have a function declared like so:
int func( int file_num, int a, int l, int g );
I decided to change this so it could accept another parameter:
int func( int file_num, int a, int l,...
Thankyou thankyou. Works a like a dream now. Good FAQ also.
Cheers.
I have a 2d array as so:
char array[num_of_files][100];
and a pointer
char* p;
" warnings:'loop' has not been used-line 34 & 153."
This is because you dont use the variable loop in those functions.
When would you create a header file?
Im guessing its for storing functions you would use in more than 1 program?
...
while ( *ai_mode != FOLLOW_LINE )
{
printf("\n\njoymode\n\n");
move_motors_with_stick(device, subdevice_an_zero, subdevice_an_one, x_scale, y_scale, x_min_read, y_min_read,...
Cant seem to implement either of those examples.
changemode(1);
if( kbhit() )
{
ch = getchar();
printf("\nGot %c\n", ch);
Im considering that now seeing as im using curses throughtout my program anyway.
Thats for the code guys.
I only want the program to quit if the user has hit a key and that key corresponds to the ESC key. Otherwise i want it to continue looping.
This is easlily done in windows(shows below), but is...
Anybody know how to use this function?
Ive been messing with it a little and ended up with a red background for the terminal, and green hashes everywhere. heh.
thanks