??? 05/16/12 18:25 Read: times |
#187382 - I am using Dennis Ritchie_ANCI C Responding to: ???'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; } |
Topic | Author | Date |
Memory Organization | 01/01/70 00:00 | |
Tried any good C book lately? | 01/01/70 00:00 | |
I am using Dennis Ritchie_ANCI C | 01/01/70 00:00 | |
Variables don't move just because you assign to them | 01/01/70 00:00 | |
can we start from ZERO........ | 01/01/70 00:00 | |
Have you read my original post? | 01/01/70 00:00 | |
mixing stuff | 01/01/70 00:00 | |
where it will be for MCU? | 01/01/70 00:00 | |
is there any book for this fundamental things? | 01/01/70 00:00 | |
and .... | 01/01/70 00:00 | |
In this a general or Specific Question | 01/01/70 00:00 | |
its General Que ???? | 01/01/70 00:00 | |
Separate "the C view of program" from "microcontroller view" | 01/01/70 00:00 | |
NO! | 01/01/70 00:00 | |
why not?? | 01/01/70 00:00 | |
No - generic isn't meaningful | 01/01/70 00:00 | |
Interview questions can be asked out of limited knowledge | 01/01/70 00:00 | |
Seldom "one" answer other than to trivial questions | 01/01/70 00:00 | |
In Addition | 01/01/70 00:00 | |
Embedded? | 01/01/70 00:00 | |
sometimes, usually | 01/01/70 00:00 |