laserlight, you recommend to make another function for the sort and leave the simple comparator (if I want to leave NULLs at their places) ?
If I move qsort from the sorting it is become available...
Type: Posts; User: c.user
laserlight, you recommend to make another function for the sort and leave the simple comparator (if I want to leave NULLs at their places) ?
If I move qsort from the sorting it is become available...
when he has 1000000 elements he deletes 500000th element it needs to move 500000 elements to the left
and if he uses pointers it is easier to delete them by assigning NULL to 500000th
when it has...
My comparator doesn't need new function which will move this NULLs to the end of the array before the sorting
And it is possible to realise such that it will save their places without moving to the...
laserlight,
person *personer[10];
this is his declaration of the array of pointers to the structures
if he wants to delete structure from the array when it filled, he frees the pointer and...
I am recommend to control the program, and you are recommend to debug the program
if it will be turned off what will happen if there will an incorrect data in that array ?
char nullflag;
...
int critter_cmp_namn (person **p1, person **p2)
{
if (!p1 || !p2 || !*p1 || !*p2)
return nullflag = 1;
return strcmp ((*p1)->fnamn, (*p2)->fnamn);
}
I tryed to leave the NULL in it's place (so now I see that the sorting will not correct though, hence it should return 1 for NULL and it is necessary to make something like errno (but local in the...
I will correct my function a bit
int critter_cmp_namn (person **p1, person **p2)
{
if (!p1 || !p2 || !*p1 || !*p2)
return 0;
return strcmp ((*p1)->fnamn, (*p2)->fnamn);
}
>>> base = [ "one", "two" ];
>>> base *= 2;
>>> base;
['one', 'two', 'one', 'two']
>>> list = [ base, base ];
>>> list;
[['one', 'two', 'one', 'two'], ['one', 'two', 'one', 'two']]
>>> del...
Jaggid1x,
-> - is special operation for this
the difference is
(*first).name
person *personer[10];
qsort (*personer, fillen, sizeof (person), critter_cmp_namn);
how would you realize this
>>> base = [ "one", "two" ];
>>> list = [ base ];
>>> list.append(base);
>>> list.append(base);
>>> list.append(base);
>>> list
[['one', 'two'], ['one', 'two'],...
struct ship_tank A[20];
int i;
for (i = 1;i <= n; i++) {
printf("Enter the numbers of tanks: ");
scanf("%d", &i);
...
}
(*first).name
change it to
first->name
#include <stdio.h>
main()
{
char *line = "term1= the cat &term2= M ";
char one[100], two[100];
if (sscanf(
line,
"%*[^=]="
#include <stdio.h>
main()
{
printf("one");
char *p = "two";
printf("%s %s %s\n", p-4, p, p+4);
return 0;
BEN10,
char *p="hello";
you know, all strings write to read-only memory, all strings like printf("one two three\n"); - "one two three\n" literal constant it goes to read-only memory and...
function for deleting any character
download it, then save_data.zip.txt => save_data.zip, then open (there is no zip or tar extension here for the attach)
#include <stdio.h>
main()
{
unsigned char line1[100];
signed char line2[100];
char line3[100];
fgets(line1, sizeof line1, stdin);
fgets(line2, sizeof line2, stdin);
I got one segmentation fault when I use int type for the array where fgets save
but when I changed it to signed char, it's ok
#include <stdio.h>
#include <ctype.h>
main()
How can you write it for the one char from dollar[0] ?
It must return that non-digit is a digit (error like)
you think function can show a digit on a non-digit character ? if this range sticked (maybe it can change for the codes, but they will be greater than zero) isdigit will know only the digits, and for...
but it should be casted while the pass to isdigit (prototype rule) and then C99 7.4.1 undefined behavior
it has greater than zero code in ASCII, so any symbol of 7-bit ASCII should not casted hence
yea, I know, but I never seen this cast in the books
you think isdigit('0') should be incorrect ? '0' will be signed
by the topic
immie86, i cleared your function (don't know how it's work and...