Hello!
I have some code that does not work.
What am i not doing right?
char *pointer[5];
pointer[0] = "ccc";
pointer[1] = "bbb";
pointer[2] = "aaa";
qsort(pointer, 3, 5, 1);
Hello!
Are there any function that i can use to sort a linked list?
For example in alphabetical order for a field.
Or does anyone have some code example?
Thank you.
Hello!
I get an irritating warning from the compiler:
myapp.c: 166: warning: implicit declaration of function 'strcmp'
Line 166 looks like this:
if(strcmp(listpointer->name, search->name)==0){
......
}
listpointer->name and search->name are char[100].
Whats the compiler complaining about...
Hello!
When should i use the fflush function?
When i read characters from the keyboard, from a file?
Should i call it before i call for example getchar or after?
What does it actualy do?
I have some questions.
Which of these two is the best design?
Ex 1.
int main()
{
int a = function1();
function2(a);
}
function1(){
int a;
.......
return a;
}
Ex 2.
int main()
{
function1();
}
function1(){
int a;
function2(a);
}
Are there any designpaterns or any standard...
Hello!
What is the differenc betwen malloc, calloc ond realloc?
The only thing i know is that malloc is used for alocating memory.
I have a bug in my code. The first time i use malloc everything works. But the next time at the same row the program "hangs up" at the point where i am calling the...
Hello!
I have a problem:
char[] function(){
char str[10];
strcpy(str, "Hello!");
return str;
}
int main(){
char str[10];
str = function();
}
The compiler tells me: incompatible types in assignment.
How should i do instead to get it work?
Hello!
After the last fgets i get the message Segmentation fault from the operating system. What am i doing wrong?
(This is ofcaurse only a part of my application)
typedef struct mystruct
{
char a[10], b[10], c[10];
struct mystruct *link;
} mystruct;
struct mystruct* inputFunction()
{...
Hello!
I have problem with the function scanf.
My program looks like this:
scanf("%s", a);
scanf("%s", b);
I run it and enter the value of a.
But after that it jumps over the other scanf so that i don't get the chance to enter the value b.
I know its possible to solve the problem so i can...
My program is supposed to write some char[] in a struct to a file.
It works but the program also add some other crap characters to the file that i dont want to have.
Why? And how do i fix it?
Thak you.
The program looks like this:
FILE *reg;
reg = fopen("/home/cproject/register.dat","w")...
Hello!
Does anyone know how to clear the screen in textmode in ansi C?
I am not allowed to use clrscr() in the conio.h file, because it is not a part of ansi C.
Thank you
Hello!
Does anyone know how to send binaryfiles(.exe) with sockets?
Not text files. Thats easy. I already know how to do that.
Some example code would be great.
Thank you.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.