Hmm... Thanks, but now I'm kinda worried. I have no clue what to do.
Type: Posts; User: itsthemac
Hmm... Thanks, but now I'm kinda worried. I have no clue what to do.
I have the following code:
// --------------- Global Variables ---------------
static char array[100];
static char * ptr;
// ------------------------------------------------
void foo()
{
Ok, thanks. I think my problem was that I thought that the assignment statement evaluated to the value being assigned. But I guess it evaluates to the value of the thing on the left of the assignment...
Thanks, got it to work using your suggestions. I never thought about the evaluation order thing, I'll keep it in mind for the next time I run into something like this. Now I have a follow-up question...
I wrote the following little test program to test out the isalpha function:
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
main(int argc, char * argv[] )
{
FILE * fp =...
Thanks! I had no idea about strdup. For some reason I just assumed malloc-ing strings was a faux pas, but I couldn't see any other way around this problem. cheers
I have a struct with the following definition:
struct node{
char * name;
struct node * next;
};
The problem is that I want to make a linked list of these nodes, each having its own...
Thank you everyone for the help!
I'm trying to gain a better intuition on how string literals work in C.
char * c = "hello";
c = "goodbye";
After the code segment above completes, what happens to the space in memory where...
thank you very much!
Ok, cool thanks. Just as an aside, is there any difference between saying
char str[] = "String";
and
char * str = "String";?
I'm new to c and need to take in a string (char *) and cut it down into its individual words. I'm not sure what the most efficient way to do this would be. For example if given the string "This is a...