Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/16/12 12:25
Read: 426 times


 
#187382 - I am using Dennis Ritchie_ANCI C
Responding to: Per Westermark's previous message
hello,

I am referring ANCI C by Dennis Ritchie.
when i go through any document or any book at time i understand but when i am trying to solve any Qus.& problem at that time i am confused ?

this is example, i understand..
for example:
int iSize; //at BSS
char *f(void)
{
char *p; //at Stack
iSize = 8; //at Data
p = malloc(iSize); //at Heap
return p;
}

but what about below example?

#include <stdio.h>
#include <string.h>
#define MAX_STRINGS 128
#define MAX_STRING_LENGTH 256
void ReadStrings(char **strings, int *nstrings, int maxstrings, FILE *fp)
{
char string[MAX_STRING_LENGTH];
*nstrings = 0;
while (fgets(string, MAX_STRING_LENGTH, fp)) {
strings[(*nstrings)++] = strdup(string);
if (*nstrings >= maxstrings) break;
}
}
...
int main()
{
char *strings[MAX_STRINGS];
int nstrings;
ReadStrings(strings, &nstrings, MAX_STRINGS, stdin);
SortStrings(strings, nstrings);
WriteStrings(strings, nstrings, stdout);
return 0;
}


List of 21 messages in thread
TopicAuthorDate
Memory Organization      Yagnesh Mehta      05/16/12 02:39      
   Tried any good C book lately?      Per Westermark      05/16/12 03:48      
      I am using Dennis Ritchie_ANCI C      Yagnesh Mehta      05/16/12 12:25      
         Variables don't move just because you assign to them      Per Westermark      05/18/12 02:33      
            can we start from ZERO........      Yagnesh Mehta      05/18/12 04:27      
               Have you read my original post?      Per Westermark      05/18/12 06:58      
               mixing stuff      Erik Malund      05/18/12 07:13      
                  where it will be for MCU?      Yagnesh Mehta      05/18/12 12:02      
                     is there any book for this fundamental things?      Andy Neil      05/18/12 14:59      
                        and ....      Erik Malund      05/18/12 16:33      
                     In this a general or Specific Question      Neil Kurzman      05/18/12 17:10      
                        its General Que ????      Yagnesh Mehta      05/18/12 23:50      
                           Separate "the C view of program" from "microcontroller view"        Per Westermark      05/19/12 01:48      
                           NO!      Erik Malund      05/19/12 15:53      
                              why not??      Yagnesh Mehta      05/20/12 21:56      
                                 No - generic isn't meaningful      Per Westermark      05/21/12 01:49      
                                 Interview questions can be asked out of limited knowledge      Kalpak Dabir      05/21/12 05:48      
                                    Seldom "one" answer other than to trivial questions      Per Westermark      05/21/12 06:41      
   In Addition      Michael Karas      05/16/12 10:24      
      Embedded?      Per Westermark      05/16/12 10:42      
   sometimes, usually      Erik Malund      05/16/12 13:17      

Back to Subject List