C Programming

Kim N. King

Mentioned 2

Suitable for students at a variety of levels, C Programming: A Modern Approach covers the C language as no book has before. Even C's most difficult concepts are easy to learn, thanks to the book's lucid explanations, carefully graded examples, and many helpful figures. A "spiral" approach to the language's features makes this book the ideal text for learning C. Clear, accurate, and up-to-date, C Programming: A Modern Approach is destined to become a classic.

More on Amazon.com

Mentioned in questions and answers.

I've read that qsort is just a generic sort, with no promises about implementation. I don't know about how libraries vary from platform to plaform, but assuming the Mac OS X and Linux implementations are broadly similar, are the qsort implementations recursive and/or require a lot of stack?

I have a large array (hundreds of thousands of elements) and I want to sort it without blowing my stack to oblivion. Alternatively, any suggestions for an equivalent for large arrays?

I remember reading in this book: C Programming: A Modern Approach that the ANSI C specification doesn't define how to implement qsort.

And the book wrote that qsort could in reality be a another kind of sort, merge sort, insertion sort and why not bubble sort :P

So, the qsort implementation might not be recursive.

#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include stdlib.h>
#include <string.h> 

#define LB_SIZE 1024

int main()(int argc, char *argv[])
     char full Pathname[] = /usr/X11R6/bin/xeyes;
     char *myArgv[LB_SIZE];  

     myArgv[0] = malloc(strlen(fullPathName) + 1);
     strcpy(myArgv[0], fullPathName);
     myArgv[1] = NULL;  
     execvp(fullPathName, myArgv);


As @Als has said, strings should be enclosed in "mystring text" quotes.

I really think you need to start learning C before coding in it. Here are some recommendations:

If you don't want to buy a book, try this free wikibook. I actually contributed a chapter to it, so please give it good ratings :).

Realated tags