Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recent content by mattias1975

  1. mattias1975

    qsort

    'sproxy' in this line: qsort(pointer,3,sizeof(char*),sproxy); Is that a function call? No variables passed to it?
  2. mattias1975

    qsort

    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);
  3. mattias1975

    ipconfig in unix and linux?

    Hello! Is there something similar to ipconfig(windows) in linux and unix that i can use to get the ip address of my computer?
  4. mattias1975

    Array of pointers

    Hello! Whats wrong with this? char *pointer[10]; strcpy(pointer[0], "hello"); printf("%s", pointer[0]); Thank you
  5. mattias1975

    Sort a linked list

    Hm. That solution does not fit in my application.
  6. mattias1975

    Decide if a number is devidable with 2

    Is there any function in c that decides if a number is devidable with 2 or not?
  7. mattias1975

    Sort a linked list

    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.
  8. mattias1975

    warning: implicit declaration of function 'strcmp'?

    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...
  9. mattias1975

    The fflush function

    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?
  10. mattias1975

    Returning char[]

    Hello! How do i return a char[] from a function? Do i have return a pointer to it? A smal example code would be nice. Thank you.
  11. mattias1975

    Code design

    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...
  12. mattias1975

    malloc, calloc and realloc

    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...
  13. mattias1975

    Problem with returning char[] from function

    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?
  14. mattias1975

    Segmentation fault

    Ok. But should i free it after i return it? Is tat possible? return hello; free(hello);
  15. mattias1975

    Segmentation fault

    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() {...

Part and Inventory Search

Back
Top