-
Created Array of struct implementation in C
I need some ideas on my array of struct implementation. This is what I have in my structs. I plan on making SHAPES an array because I will have multiple … -
Replied To a Post in Command Line Arguments with integers
What about this part? How do you handle this? No-throw guarantee: this function never throws exceptions. If str does not point to a valid C-string, or if endptr does not … -
Replied To a Post in Command Line Arguments with integers
Whats wrong with atoi? I have used it in the past with no issues. Why is strtol better? -
Created Command Line Arguments with integers
I know this works as expected if your command line arguments are strings. #include <stdio.h> int main( int argc, char *argv[] ) { printf("Program name %sn", argv[0]); if( argc == … -
Replied To a Post in warning: cast from pointer to integer of different size
If I would have used calloc would I of still had to initialize strings? Would something like that have worked? From what I have been reading about calloc it sounds … -
Created read from file and print output to a file
I know this is how you read from a file. I also want to print my output to the same name of the file plus ".txt". So if my file … -
Created pointer question of function
What does creating a pointer of a function do? I'm not used to getValue being a pointer. char* getValue(char* string); I'm used to something like this. char getValue(char* string); -
Edited output gets messed up when redirected to a file
Here is my code that is doing the printing that gets messed up. The output is fine when you display it to your screen (terminal). Unfortunately when you redirect it … -
Created output gets messed up when redirected to a file
Here is my code that is doing the printing that gets messed up. The output is fine when you display it to your screen (terminal). Unfortunately when you redirect it … -
Replied To a Post in slow down program output
I looked at the man pages and saw those were the maximum values of usleep() and nanosleep(). With sleep I thought I would get a normal 5 seconds. I am … -
Created slow down program output
Is there a good way to slow down program output? usleep and nanosleep don't slow it down enough, delay doesn't work, and sleep keeps freezing my program. I am using … -
Replied To a Post in strcpy of string to array of string
Could you elaborate on that please? I thought those are 2 separate things. I thought the first one is declaring a char pointer to stdup. I thought the second one … -
Created fgets with sscanf new line vs carriage return
I am using fgets to read lines of a file. I am then using if statements based on the location of the new line character to decide which sscanf to … -
Replied To a Post in strcpy of string to array of string
I figured it out. I didn't allocate memory. -
Created strcpy of string to array of string
I am trying to copy a string to an array of string. I have used these two examples before and they have worked so I don't understand why they won't … -
Replied To a Post in convert decimal to hex then do hex math
I wanna do everything in Hex. The only 2 ways to convert is to make an array which you can't do math with a char array and the %x option … -
Created convert decimal to hex then do hex math
How would you go about converting a decimal value to hex and then do math? Every example of converting decimal to hex that I have seen creates an array and … -
Marked Solved Status for check for set of characters in array of characters
I have an array of characters. I am trying to find "houston". The only way I can think of to do this is to use a for loop and check … -
Replied To a Post in check for set of characters in array of characters
Yes :). Marking as solved ;). -
Created clear the first character of an array
I am trying to clear the first character of my array. The first two methods don't seem to work. The third method seems to but doesn't look like a good … -
Replied To a Post in check for set of characters in array of characters
This did what I want. char *pch; char string[] = "Fishing tourism miami atlanta dallas houston"; pch = strstr (string,"houston"); if(pch != NULL && start_flag != 1) { //Do Work … -
Created check for set of characters in array of characters
I have an array of characters. I am trying to find "houston". The only way I can think of to do this is to use a for loop and check … -
Replied To a Post in weird int declaration
They have #defines at the top. #define for_x for (int x = 0; x < w; x++) #define for_y for (int y = 0; y < h; y++) #define for_xy … -
Replied To a Post in unistd.h
I'm trying to understand some code on rosetta stone and I thought actually understanding that library would help. -
Created unistd.h
Can someone please explain what unistd.h does and the purpose of it? I have been googleing the last hour and I don't understand it. -
Created weird int declaration
Can you please explain what this weird int declaration does. Here is the block of code. void show(void *u, int w, int h) { int (*univ)[w] = u; printf("\033[H"); for_y … -
Replied To a Post in warning: cast from pointer to integer of different size
Thank you :). It worked :). -
Replied To a Post in warning: cast from pointer to integer of different size
I want to use strcmp on my array of string. I want to know if my value is already in my array. I obviously can't do that on my null … -
Created warning: cast from pointer to integer of different size
Can someone please explain this error and how to fix it? This worked perfectly on my computer but it stopped working when I transferred it to another computer. int hash … -
Created strcmp of array of strings and string
Can someone please tell me what is wrong with strcmp? I don't understand why I am getting a segmentation fault when comparing array of strings and string. char *strings[100]; char … -
Created malloc vs calloc
Can I please have a good detailed explanation on the differences between malloc and calloc? I always have trouble understanding that. -
Created data length of number types
Can someone please tell me the the maximum and minimum of int, long int, long long int, double, float, and anything bigger than that? And also how to calculate this? -
Created Read an inconsistent file
Which file readers in C can handle reading an inconsistent file? Sometimes the file is "word number" and other times it is just "word". Like this. bob 456 echo cat … -
Replied To a Post in fscanf newline vs space
Is this a bad idea? -
Created fscanf newline vs space
I am trying to use fscanf to read a file. When fscanf hits a newline I would like it to do one thing and when it hits a space I … -
Created string to ascii
I've seen a few different ways to convert a string to ascii and I was wondering what is the best way and why. char str[100]; int i=0; printf("Enter any string: … -
Replied To a Post in read file character by character for char and the number set for numbers
@Ancient Dragon The reason for modding it is I want to use a hash table to check if I have already stored a value. If I have I will need … -
Replied To a Post in read file character by character for char and the number set for numbers
@Ancient Dragon Can you tell me what the single quotes are for with '0'? I was using an int. I thought the single quotes are for char. I intend to … -
Created read file character by character for char and the number set for numbers
Is there a way to read a file character by character for chars and the number set for numbers? bob 4567 joe 39083 sara 4239824 That is my file while … -
Replied To a Post in fscanf vs fgetc
And if you need a char you always cast it like this :). while ((c = fgetc(pFile)) != EOF) { vertices[addcounter] = (char)c; } -
Created printing array of linked lists
I am trying to print an array of linked lists. I am having trouble getting it to print. Here is my struct. typedef struct VERTEXTAG { char c; bool isvisited; … -
Replied To a Post in fscanf vs fgetc
Thank you :). Were both saying the same thing but can't explain it in a way the other understands. -
Replied To a Post in fscanf vs fgetc
My understanding of fgetc is it reads character by character of a file. They think fscanf can also read character by character of a file. I do not think that … -
Created fscanf vs fgetc
What is the difference between fscanf and fgetc? I have a few people arguing with me on the differences. I thought fgetc reads character by character of a file. I … -
Created Gcc check version of C89, C90, C99
Is there a way to check the default version of C89, C90, or C99 that gcc uses to compile your programs? I tried -v and --version but they only give … -
Created Linked list of chars In c
When doing a linked list of chars with just a single character do you think it's better to use pointers in your struct like this? Typedef struct String_Node { Struct …
The End.